diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index bd3455924..ec7c0594e 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -24,7 +24,7 @@ jobs: python-version: 3.7 - name: Set up chart-testing - uses: helm/chart-testing-action@v2.6.0 + uses: helm/chart-testing-action@cb49023b9227b1097e5eddd8824f48bdea11b1aa - name: Run chart-testing (list-changed) id: list-changed diff --git a/apis/fluentd/v1alpha1/clusterfluentdconfig_types.go b/apis/fluentd/v1alpha1/clusterfluentdconfig_types.go index ea5f5fea1..1ba311a9d 100644 --- a/apis/fluentd/v1alpha1/clusterfluentdconfig_types.go +++ b/apis/fluentd/v1alpha1/clusterfluentdconfig_types.go @@ -50,6 +50,8 @@ type ClusterFluentdConfigSpec struct { ClusterFilterSelector *metav1.LabelSelector `json:"clusterFilterSelector,omitempty"` // Select cluster output plugins ClusterOutputSelector *metav1.LabelSelector `json:"clusterOutputSelector,omitempty"` + // Select cluster input plugins + ClusterInputSelector *metav1.LabelSelector `json:"clusterInputSelector,omitempty"` } // ClusterFluentdConfigStatus defines the observed state of ClusterFluentdConfig diff --git a/apis/fluentd/v1alpha1/clusterinput_types.go b/apis/fluentd/v1alpha1/clusterinput_types.go new file mode 100644 index 000000000..1d5347b37 --- /dev/null +++ b/apis/fluentd/v1alpha1/clusterinput_types.go @@ -0,0 +1,61 @@ +/* +Copyright 2023. + +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 ( + "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1/plugins/input" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ClusterInputSpec defines the desired state of ClusterInput +type ClusterInputSpec struct { + Inputs []input.Input `json:"inputs,omitempty"` +} + +// ClusterInputStatus defines the observed state of ClusterInput +type ClusterInputStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:shortName=cfdi,scope=Cluster +// +genclient +// +genclient:nonNamespaced + +// ClusterInput is the Schema for the clusterinputs API +type ClusterInput struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ClusterInputSpec `json:"spec,omitempty"` + Status ClusterInputStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ClusterInputList contains a list of ClusterInput +type ClusterInputList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClusterInput `json:"items"` +} + +func init() { + SchemeBuilder.Register(&ClusterInput{}, &ClusterInputList{}) +} diff --git a/apis/fluentd/v1alpha1/fluentd_types.go b/apis/fluentd/v1alpha1/fluentd_types.go index e86abd699..d0ddfc1a4 100644 --- a/apis/fluentd/v1alpha1/fluentd_types.go +++ b/apis/fluentd/v1alpha1/fluentd_types.go @@ -36,6 +36,8 @@ const ( type FluentdSpec struct { // Fluentd global inputs. GlobalInputs []input.Input `json:"globalInputs,omitempty"` + // Select cluster input plugins used to gather the default cluster output + DefaultInputSelector *metav1.LabelSelector `json:"defaultInputSelector,omitempty"` // Select cluster filter plugins used to filter for the default cluster output DefaultFilterSelector *metav1.LabelSelector `json:"defaultFilterSelector,omitempty"` // Select cluster output plugins used to send all logs that did not match any route to the matching outputs diff --git a/apis/fluentd/v1alpha1/fluentdconfig_types.go b/apis/fluentd/v1alpha1/fluentdconfig_types.go index cf5d98768..11e3673e6 100644 --- a/apis/fluentd/v1alpha1/fluentdconfig_types.go +++ b/apis/fluentd/v1alpha1/fluentdconfig_types.go @@ -41,10 +41,14 @@ type FluentdConfigSpec struct { FilterSelector *metav1.LabelSelector `json:"filterSelector,omitempty"` // Select namespaced output plugins OutputSelector *metav1.LabelSelector `json:"outputSelector,omitempty"` + // Select cluster input plugins + InputSelector *metav1.LabelSelector `json:"inputSelector,omitempty"` // Select cluster filter plugins ClusterFilterSelector *metav1.LabelSelector `json:"clusterFilterSelector,omitempty"` // Select cluster output plugins ClusterOutputSelector *metav1.LabelSelector `json:"clusterOutputSelector,omitempty"` + // Select cluster input plugins + ClusterInputSelector *metav1.LabelSelector `json:"clusterInputSelector,omitempty"` } // FluentdConfigStatus defines the observed state of FluentdConfig diff --git a/apis/fluentd/v1alpha1/helper.go b/apis/fluentd/v1alpha1/helper.go index a9701f4cf..7ab96daf4 100644 --- a/apis/fluentd/v1alpha1/helper.go +++ b/apis/fluentd/v1alpha1/helper.go @@ -36,10 +36,12 @@ type PluginResources struct { // +kubebuilder:object:generate=false // All the filter/output selected to this cfg type CfgResources struct { + InputPlugins []params.PluginStore FilterPlugins []params.PluginStore OutputPlugins []params.PluginStore // the hash codes used to depulicate removel + InputsHashcodes map[string]bool FiltersHashcodes map[string]bool OutputsHashcodes map[string]bool } @@ -59,6 +61,7 @@ func NewCfgResources() *CfgResources { FilterPlugins: make([]params.PluginStore, 0), OutputPlugins: make([]params.PluginStore, 0), + InputsHashcodes: make(map[string]bool), FiltersHashcodes: make(map[string]bool), OutputsHashcodes: make(map[string]bool), } @@ -109,6 +112,7 @@ func (pgr *PluginResources) BuildCfgRouter(cfg Renderer) (*fluentdRouter.Route, func (pgr *PluginResources) PatchAndFilterClusterLevelResources( sl plugins.SecretLoader, cfgId string, + clusterInputs []ClusterInput, clusterfilters []ClusterFilter, clusteroutputs []ClusterOutput, ) (*CfgResources, []string) { @@ -117,6 +121,15 @@ func (pgr *PluginResources) PatchAndFilterClusterLevelResources( errs := make([]string, 0) + // List all inputs matching the label selector. + for _, i := range clusterInputs { + // patch filterId + err := cfgResources.filterForInputs(cfgId, "cluster", i.Name, "clusterinput", sl, i.Spec.Inputs) + if err != nil { + errs = append(errs, err.Error()) + } + } + // List all filters matching the label selector. for _, i := range clusterfilters { // patch filterId @@ -143,6 +156,7 @@ func (pgr *PluginResources) PatchAndFilterClusterLevelResources( func (pgr *PluginResources) PatchAndFilterNamespacedLevelResources( sl plugins.SecretLoader, cfgId string, + inputs []Input, filters []Filter, outputs []Output, ) (*CfgResources, []string) { @@ -151,6 +165,15 @@ func (pgr *PluginResources) PatchAndFilterNamespacedLevelResources( errs := make([]string, 0) + // List all inputs matching the label selector. + for _, i := range inputs { + // patch filterId + err := cfgResources.filterForInputs(cfgId, i.Namespace, i.Name, "filter", sl, i.Spec.Inputs) + if err != nil { + errs = append(errs, err.Error()) + } + } + // List all filters matching the label selector. for _, i := range filters { // patch filterId @@ -172,6 +195,35 @@ func (pgr *PluginResources) PatchAndFilterNamespacedLevelResources( return cfgResources, errs } +func (r *CfgResources) filterForInputs( + cfgId, namespace, name, crdtype string, + sl plugins.SecretLoader, + inputs []input.Input, +) error { + for n, input := range inputs { + inputId := fmt.Sprintf("%s::%s::%s::%s-%d", cfgId, namespace, crdtype, name, n) + input.InputCommon.Id = &inputId + // if input.InputCommon.Tag == nil { + // input.InputCommon.Tag = ¶ms.DefaultTag + // } + + ps, err := input.Params(sl) + if err != nil { + return err + } + + hashcode := ps.Hash() + if _, ok := r.InputsHashcodes[hashcode]; ok { + continue + } + + r.InputsHashcodes[hashcode] = true + r.InputPlugins = append(r.InputPlugins, *ps) + } + + return nil +} + func (r *CfgResources) filterForFilters( cfgId, namespace, name, crdtype string, sl plugins.SecretLoader, @@ -232,10 +284,13 @@ func (r *CfgResources) filterForOutputs( // convert the cfg plugins to a label plugin, appends to the global label plugins func (pgr *PluginResources) WithCfgResources(cfgRouteLabel string, r *CfgResources) error { - if len(r.FilterPlugins) == 0 && len(r.OutputPlugins) == 0 { + if len(r.InputPlugins) == 0 && len(r.FilterPlugins) == 0 && len(r.OutputPlugins) == 0 { return errors.New("no filter plugins and no output plugins matched") } + // insert input plugins of this fluentd config + pgr.InputPlugins = append(pgr.InputPlugins, r.InputPlugins...) + cfgLabelPlugin := params.NewPluginStore("label") cfgLabelPlugin.InsertPairs("tag", cfgRouteLabel) diff --git a/apis/fluentd/v1alpha1/input_types.go b/apis/fluentd/v1alpha1/input_types.go new file mode 100644 index 000000000..33858765e --- /dev/null +++ b/apis/fluentd/v1alpha1/input_types.go @@ -0,0 +1,63 @@ +/* +Copyright 2023. + +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 ( + "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1/plugins/input" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// InputSpec defines the desired state of Input +type InputSpec struct { + Inputs []input.Input `json:"inputs,omitempty"` +} + +// InputStatus defines the observed state of Input +type InputStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:shortName=fdi +// +genclient + +// Input is the Schema for the inputs API +type Input struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec InputSpec `json:"spec,omitempty"` + Status InputStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// InputList contains a list of Input +type InputList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Input `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Input{}, &InputList{}) +} diff --git a/apis/fluentd/v1alpha1/plugins/input/types.go b/apis/fluentd/v1alpha1/plugins/input/types.go index 610ef90ad..2d8c2f53c 100644 --- a/apis/fluentd/v1alpha1/plugins/input/types.go +++ b/apis/fluentd/v1alpha1/plugins/input/types.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1/plugins" + "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1/plugins/custom" "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1/plugins/params" ) @@ -31,6 +32,8 @@ type Input struct { Tail *Tail `json:"tail,omitempty"` // in_sample plugin Sample *Sample `json:"sample,omitempty"` + // Custom plugin type + CustomPlugin *custom.CustomPlugin `json:"customPlugin,omitempty"` } // DeepCopyInto implements the DeepCopyInto interface. @@ -85,6 +88,12 @@ func (i *Input) Params(loader plugins.SecretLoader) (*params.PluginStore, error) return i.samplePlugin(ps, loader), nil } + if i.CustomPlugin != nil { + customPs, _ := i.CustomPlugin.Params(loader) + ps.Content = customPs.Content + return ps, nil + } + return nil, errors.New("you must define an input plugin") } diff --git a/apis/fluentd/v1alpha1/tests/helper_test.go b/apis/fluentd/v1alpha1/tests/helper_test.go index 075e91440..64c499f17 100644 --- a/apis/fluentd/v1alpha1/tests/helper_test.go +++ b/apis/fluentd/v1alpha1/tests/helper_test.go @@ -27,7 +27,7 @@ func Test_Cfg2ES(t *testing.T) { clusterOutputsForCluster := []fluentdv1alpha1.ClusterOutput{FluentdclusterOutput2ES} cfgRouter, err := psr.BuildCfgRouter(&FluentdConfig1) g.Expect(err).NotTo(HaveOccurred()) - cfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) + cfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) err = psr.WithCfgResources(*cfgRouter.Label, cfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -53,7 +53,7 @@ func Test_ClusterCfgInputTail(t *testing.T) { clustercfgRouter, err := psr.BuildCfgRouter(&FluentdConfig1) g.Expect(err).NotTo(HaveOccurred()) clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutputTag} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -76,7 +76,7 @@ func Test_ClusterCfgInputSample(t *testing.T) { clustercfgRouter, err := psr.BuildCfgRouter(&FluentdConfig1) g.Expect(err).NotTo(HaveOccurred()) clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutputTag} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -99,7 +99,7 @@ func Test_ClusterCfgOutput2ES(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterFilters := []fluentdv1alpha1.ClusterFilter{} clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdclusterOutput2ES} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -125,7 +125,7 @@ func Test_Cfg2OpenSearch(t *testing.T) { clusterOutputsForCluster := []fluentdv1alpha1.ClusterOutput{FluentdclusterOutput2OpenSearch} cfgRouter, err := psr.BuildCfgRouter(&FluentdConfig1) g.Expect(err).NotTo(HaveOccurred()) - cfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) + cfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) err = psr.WithCfgResources(*cfgRouter.Label, cfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -151,7 +151,7 @@ func Test_ClusterCfgOutput2OpenSearch(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterFilters := []fluentdv1alpha1.ClusterFilter{} clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdclusterOutput2OpenSearch} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -178,7 +178,7 @@ func Test_ClusterCfgOutput2Kafka(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterFilters := []fluentdv1alpha1.ClusterFilter{FluentdClusterFilter1} clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutput2kafka} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -205,7 +205,7 @@ func Test_ClusterCfgOutput2Loki(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterFilters := []fluentdv1alpha1.ClusterFilter{FluentdClusterFilter1} clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutput2Loki} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -231,13 +231,13 @@ func Test_MixedCfgs2ES(t *testing.T) { clustercfgRouter, err := psr.BuildCfgRouter(&FluentdClusterFluentdConfig1) g.Expect(err).NotTo(HaveOccurred()) clusterOutputsForCluster := []fluentdv1alpha1.ClusterOutput{FluentdclusterOutput2ES} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) cfgRouter, err := psr.BuildCfgRouter(&FluentdConfig1) g.Expect(err).NotTo(HaveOccurred()) - cfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) + cfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) err = psr.WithCfgResources(*cfgRouter.Label, cfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -264,7 +264,7 @@ func Test_ClusterCfgOutput2CloudWatch(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterFilters := []fluentdv1alpha1.ClusterFilter{FluentdClusterFilter1} clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutput2CloudWatch} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -290,7 +290,7 @@ func Test_ClusterCfgOutput2Datadog(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterFilters := []fluentdv1alpha1.ClusterFilter{FluentdClusterFilter1} clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutput2Datadog} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -315,13 +315,13 @@ func Test_MixedCfgs2OpenSearch(t *testing.T) { clustercfgRouter, err := psr.BuildCfgRouter(&FluentdClusterFluentdConfig1) g.Expect(err).NotTo(HaveOccurred()) clusterOutputsForCluster := []fluentdv1alpha1.ClusterOutput{FluentdclusterOutput2OpenSearch} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) cfgRouter, err := psr.BuildCfgRouter(&FluentdConfig1) g.Expect(err).NotTo(HaveOccurred()) - cfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) + cfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) err = psr.WithCfgResources(*cfgRouter.Label, cfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -347,7 +347,7 @@ func Test_MixedCfgs2MultiTenant(t *testing.T) { clustercfgRouter, err := psr.BuildCfgRouter(&FluentdClusterFluentdConfig2) g.Expect(err).NotTo(HaveOccurred()) clusterOutputsForCluster := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutputCluster} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig2.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig2.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForCluster) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -355,8 +355,8 @@ func Test_MixedCfgs2MultiTenant(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterOutputsForUser1 := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutputLogOperator} outputsForUser1 := []fluentdv1alpha1.Output{FluentdOutputUser1} - clustercfgResourcesForUser1, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfigUser1.GetCfgId(), []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForUser1) - cfgResourcesForUser1, _ := psr.PatchAndFilterNamespacedLevelResources(sl, FluentdConfigUser1.GetCfgId(), []fluentdv1alpha1.Filter{}, outputsForUser1) + clustercfgResourcesForUser1, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdConfigUser1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, []fluentdv1alpha1.ClusterFilter{}, clusterOutputsForUser1) + cfgResourcesForUser1, _ := psr.PatchAndFilterNamespacedLevelResources(sl, FluentdConfigUser1.GetCfgId(), []fluentdv1alpha1.Input{}, []fluentdv1alpha1.Filter{}, outputsForUser1) cfgResourcesForUser1.FilterPlugins = append(cfgResourcesForUser1.FilterPlugins, clustercfgResourcesForUser1.FilterPlugins...) cfgResourcesForUser1.OutputPlugins = append(cfgResourcesForUser1.OutputPlugins, clustercfgResourcesForUser1.OutputPlugins...) err = psr.WithCfgResources(*cfgRouter.Label, cfgResourcesForUser1) @@ -385,7 +385,7 @@ func Test_OutputWithBuffer(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterFilters := []fluentdv1alpha1.ClusterFilter{FluentdClusterFilter1} clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutputBuffer} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -586,13 +586,13 @@ func Test_DuplicateRemovalCRSpecs(t *testing.T) { clustercfgRouter, err := psr.BuildCfgRouter(&clustercfg) g.Expect(err).NotTo(HaveOccurred()) - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, clustercfg.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, clustercfg.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) cfgRouter, err := psr.BuildCfgRouter(&cfg) g.Expect(err).NotTo(HaveOccurred()) - cfgResources, _ := psr.PatchAndFilterNamespacedLevelResources(sl, cfg.GetCfgId(), filters, outputs) + cfgResources, _ := psr.PatchAndFilterNamespacedLevelResources(sl, cfg.GetCfgId(), []fluentdv1alpha1.Input{}, filters, outputs) err = psr.WithCfgResources(*cfgRouter.Label, cfgResources) g.Expect(err).NotTo(HaveOccurred()) @@ -619,7 +619,7 @@ func Test_RecordTransformer(t *testing.T) { g.Expect(err).NotTo(HaveOccurred()) clusterFilters := []fluentdv1alpha1.ClusterFilter{FluentdClusterRecordTransformerFilter} clusterOutputs := []fluentdv1alpha1.ClusterOutput{FluentdClusterOutputCluster} - clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), clusterFilters, clusterOutputs) + clustercfgResources, _ := psr.PatchAndFilterClusterLevelResources(sl, FluentdClusterFluentdConfig1.GetCfgId(), []fluentdv1alpha1.ClusterInput{}, clusterFilters, clusterOutputs) err = psr.WithCfgResources(*clustercfgRouter.Label, clustercfgResources) g.Expect(err).NotTo(HaveOccurred()) diff --git a/apis/fluentd/v1alpha1/zz_generated.deepcopy.go b/apis/fluentd/v1alpha1/zz_generated.deepcopy.go index 261ed1915..25bbbf95c 100644 --- a/apis/fluentd/v1alpha1/zz_generated.deepcopy.go +++ b/apis/fluentd/v1alpha1/zz_generated.deepcopy.go @@ -251,6 +251,11 @@ func (in *ClusterFluentdConfigSpec) DeepCopyInto(out *ClusterFluentdConfigSpec) *out = new(v1.LabelSelector) (*in).DeepCopyInto(*out) } + if in.ClusterInputSelector != nil { + in, out := &in.ClusterInputSelector, &out.ClusterInputSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterFluentdConfigSpec. @@ -278,6 +283,102 @@ func (in *ClusterFluentdConfigStatus) DeepCopy() *ClusterFluentdConfigStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInput) DeepCopyInto(out *ClusterInput) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInput. +func (in *ClusterInput) DeepCopy() *ClusterInput { + if in == nil { + return nil + } + out := new(ClusterInput) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterInput) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInputList) DeepCopyInto(out *ClusterInputList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterInput, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInputList. +func (in *ClusterInputList) DeepCopy() *ClusterInputList { + if in == nil { + return nil + } + out := new(ClusterInputList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterInputList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInputSpec) DeepCopyInto(out *ClusterInputSpec) { + *out = *in + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make([]input.Input, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInputSpec. +func (in *ClusterInputSpec) DeepCopy() *ClusterInputSpec { + if in == nil { + return nil + } + out := new(ClusterInputSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterInputStatus) DeepCopyInto(out *ClusterInputStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterInputStatus. +func (in *ClusterInputStatus) DeepCopy() *ClusterInputStatus { + if in == nil { + return nil + } + out := new(ClusterInputStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterOutput) DeepCopyInto(out *ClusterOutput) { *out = *in @@ -615,6 +716,11 @@ func (in *FluentdConfigSpec) DeepCopyInto(out *FluentdConfigSpec) { *out = new(v1.LabelSelector) (*in).DeepCopyInto(*out) } + if in.InputSelector != nil { + in, out := &in.InputSelector, &out.InputSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } if in.ClusterFilterSelector != nil { in, out := &in.ClusterFilterSelector, &out.ClusterFilterSelector *out = new(v1.LabelSelector) @@ -625,6 +731,11 @@ func (in *FluentdConfigSpec) DeepCopyInto(out *FluentdConfigSpec) { *out = new(v1.LabelSelector) (*in).DeepCopyInto(*out) } + if in.ClusterInputSelector != nil { + in, out := &in.ClusterInputSelector, &out.ClusterInputSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FluentdConfigSpec. @@ -694,6 +805,11 @@ func (in *FluentdSpec) DeepCopyInto(out *FluentdSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.DefaultInputSelector != nil { + in, out := &in.DefaultInputSelector, &out.DefaultInputSelector + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } if in.DefaultFilterSelector != nil { in, out := &in.DefaultFilterSelector, &out.DefaultFilterSelector *out = new(v1.LabelSelector) @@ -838,6 +954,102 @@ func (in *FluentdStatus) DeepCopy() *FluentdStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Input) DeepCopyInto(out *Input) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Input. +func (in *Input) DeepCopy() *Input { + if in == nil { + return nil + } + out := new(Input) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Input) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InputList) DeepCopyInto(out *InputList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Input, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InputList. +func (in *InputList) DeepCopy() *InputList { + if in == nil { + return nil + } + out := new(InputList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *InputList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InputSpec) DeepCopyInto(out *InputSpec) { + *out = *in + if in.Inputs != nil { + in, out := &in.Inputs, &out.Inputs + *out = make([]input.Input, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InputSpec. +func (in *InputSpec) DeepCopy() *InputSpec { + if in == nil { + return nil + } + out := new(InputSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InputStatus) DeepCopyInto(out *InputStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InputStatus. +func (in *InputStatus) DeepCopy() *InputStatus { + if in == nil { + return nil + } + out := new(InputStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Output) DeepCopyInto(out *Output) { *out = *in diff --git a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/clusterinput.go b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/clusterinput.go new file mode 100644 index 000000000..410c7d57c --- /dev/null +++ b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/clusterinput.go @@ -0,0 +1,183 @@ +/* +Copyright 2022. + +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1" + scheme "github.com/fluent/fluent-operator/v2/apis/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ClusterInputsGetter has a method to return a ClusterInputInterface. +// A group's client should implement this interface. +type ClusterInputsGetter interface { + ClusterInputs() ClusterInputInterface +} + +// ClusterInputInterface has methods to work with ClusterInput resources. +type ClusterInputInterface interface { + Create(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.CreateOptions) (*v1alpha1.ClusterInput, error) + Update(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.UpdateOptions) (*v1alpha1.ClusterInput, error) + UpdateStatus(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.UpdateOptions) (*v1alpha1.ClusterInput, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterInput, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterInputList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterInput, err error) + ClusterInputExpansion +} + +// clusterInputs implements ClusterInputInterface +type clusterInputs struct { + client rest.Interface +} + +// newClusterInputs returns a ClusterInputs +func newClusterInputs(c *FluentdV1alpha1Client) *clusterInputs { + return &clusterInputs{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterInput, and returns the corresponding clusterInput object, and an error if there is any. +func (c *clusterInputs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterInput, err error) { + result = &v1alpha1.ClusterInput{} + err = c.client.Get(). + Resource("clusterinputs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterInputs that match those selectors. +func (c *clusterInputs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterInputList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ClusterInputList{} + err = c.client.Get(). + Resource("clusterinputs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterInputs. +func (c *clusterInputs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("clusterinputs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterInput and creates it. Returns the server's representation of the clusterInput, and an error, if there is any. +func (c *clusterInputs) Create(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.CreateOptions) (result *v1alpha1.ClusterInput, err error) { + result = &v1alpha1.ClusterInput{} + err = c.client.Post(). + Resource("clusterinputs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterInput). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterInput and updates it. Returns the server's representation of the clusterInput, and an error, if there is any. +func (c *clusterInputs) Update(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.UpdateOptions) (result *v1alpha1.ClusterInput, err error) { + result = &v1alpha1.ClusterInput{} + err = c.client.Put(). + Resource("clusterinputs"). + Name(clusterInput.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterInput). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *clusterInputs) UpdateStatus(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.UpdateOptions) (result *v1alpha1.ClusterInput, err error) { + result = &v1alpha1.ClusterInput{} + err = c.client.Put(). + Resource("clusterinputs"). + Name(clusterInput.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterInput). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterInput and deletes it. Returns an error if one occurs. +func (c *clusterInputs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterinputs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterInputs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("clusterinputs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterInput. +func (c *clusterInputs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterInput, err error) { + result = &v1alpha1.ClusterInput{} + err = c.client.Patch(pt). + Resource("clusterinputs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_clusterinput.go b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_clusterinput.go new file mode 100644 index 000000000..0e752dee6 --- /dev/null +++ b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_clusterinput.go @@ -0,0 +1,132 @@ +/* +Copyright 2022. + +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeClusterInputs implements ClusterInputInterface +type FakeClusterInputs struct { + Fake *FakeFluentdV1alpha1 +} + +var clusterinputsResource = schema.GroupVersionResource{Group: "fluentd.fluent.io", Version: "v1alpha1", Resource: "clusterinputs"} + +var clusterinputsKind = schema.GroupVersionKind{Group: "fluentd.fluent.io", Version: "v1alpha1", Kind: "ClusterInput"} + +// Get takes name of the clusterInput, and returns the corresponding clusterInput object, and an error if there is any. +func (c *FakeClusterInputs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterInput, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterinputsResource, name), &v1alpha1.ClusterInput{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterInput), err +} + +// List takes label and field selectors, and returns the list of ClusterInputs that match those selectors. +func (c *FakeClusterInputs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterInputList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterinputsResource, clusterinputsKind, opts), &v1alpha1.ClusterInputList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterInputList{ListMeta: obj.(*v1alpha1.ClusterInputList).ListMeta} + for _, item := range obj.(*v1alpha1.ClusterInputList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested clusterInputs. +func (c *FakeClusterInputs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterinputsResource, opts)) +} + +// Create takes the representation of a clusterInput and creates it. Returns the server's representation of the clusterInput, and an error, if there is any. +func (c *FakeClusterInputs) Create(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.CreateOptions) (result *v1alpha1.ClusterInput, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterinputsResource, clusterInput), &v1alpha1.ClusterInput{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterInput), err +} + +// Update takes the representation of a clusterInput and updates it. Returns the server's representation of the clusterInput, and an error, if there is any. +func (c *FakeClusterInputs) Update(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.UpdateOptions) (result *v1alpha1.ClusterInput, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterinputsResource, clusterInput), &v1alpha1.ClusterInput{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterInput), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeClusterInputs) UpdateStatus(ctx context.Context, clusterInput *v1alpha1.ClusterInput, opts v1.UpdateOptions) (*v1alpha1.ClusterInput, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(clusterinputsResource, "status", clusterInput), &v1alpha1.ClusterInput{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterInput), err +} + +// Delete takes name of the clusterInput and deletes it. Returns an error if one occurs. +func (c *FakeClusterInputs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(clusterinputsResource, name, opts), &v1alpha1.ClusterInput{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterInputs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterinputsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterInputList{}) + return err +} + +// Patch applies the patch and returns the patched clusterInput. +func (c *FakeClusterInputs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterInput, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterinputsResource, name, pt, data, subresources...), &v1alpha1.ClusterInput{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterInput), err +} diff --git a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_fluentd_client.go b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_fluentd_client.go index ade7de909..1fcd1bfe9 100644 --- a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_fluentd_client.go +++ b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_fluentd_client.go @@ -35,6 +35,10 @@ func (c *FakeFluentdV1alpha1) ClusterFluentdConfigs() v1alpha1.ClusterFluentdCon return &FakeClusterFluentdConfigs{c} } +func (c *FakeFluentdV1alpha1) ClusterInputs() v1alpha1.ClusterInputInterface { + return &FakeClusterInputs{c} +} + func (c *FakeFluentdV1alpha1) ClusterOutputs() v1alpha1.ClusterOutputInterface { return &FakeClusterOutputs{c} } @@ -51,6 +55,10 @@ func (c *FakeFluentdV1alpha1) FluentdConfigs(namespace string) v1alpha1.FluentdC return &FakeFluentdConfigs{c, namespace} } +func (c *FakeFluentdV1alpha1) Inputs(namespace string) v1alpha1.InputInterface { + return &FakeInputs{c, namespace} +} + func (c *FakeFluentdV1alpha1) Outputs(namespace string) v1alpha1.OutputInterface { return &FakeOutputs{c, namespace} } diff --git a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_input.go b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_input.go new file mode 100644 index 000000000..49cf47b6d --- /dev/null +++ b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fake/fake_input.go @@ -0,0 +1,141 @@ +/* +Copyright 2022. + +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeInputs implements InputInterface +type FakeInputs struct { + Fake *FakeFluentdV1alpha1 + ns string +} + +var inputsResource = schema.GroupVersionResource{Group: "fluentd.fluent.io", Version: "v1alpha1", Resource: "inputs"} + +var inputsKind = schema.GroupVersionKind{Group: "fluentd.fluent.io", Version: "v1alpha1", Kind: "Input"} + +// Get takes name of the input, and returns the corresponding input object, and an error if there is any. +func (c *FakeInputs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Input, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(inputsResource, c.ns, name), &v1alpha1.Input{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Input), err +} + +// List takes label and field selectors, and returns the list of Inputs that match those selectors. +func (c *FakeInputs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.InputList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(inputsResource, inputsKind, c.ns, opts), &v1alpha1.InputList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.InputList{ListMeta: obj.(*v1alpha1.InputList).ListMeta} + for _, item := range obj.(*v1alpha1.InputList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested inputs. +func (c *FakeInputs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(inputsResource, c.ns, opts)) + +} + +// Create takes the representation of a input and creates it. Returns the server's representation of the input, and an error, if there is any. +func (c *FakeInputs) Create(ctx context.Context, input *v1alpha1.Input, opts v1.CreateOptions) (result *v1alpha1.Input, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(inputsResource, c.ns, input), &v1alpha1.Input{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Input), err +} + +// Update takes the representation of a input and updates it. Returns the server's representation of the input, and an error, if there is any. +func (c *FakeInputs) Update(ctx context.Context, input *v1alpha1.Input, opts v1.UpdateOptions) (result *v1alpha1.Input, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(inputsResource, c.ns, input), &v1alpha1.Input{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Input), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeInputs) UpdateStatus(ctx context.Context, input *v1alpha1.Input, opts v1.UpdateOptions) (*v1alpha1.Input, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(inputsResource, "status", c.ns, input), &v1alpha1.Input{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Input), err +} + +// Delete takes name of the input and deletes it. Returns an error if one occurs. +func (c *FakeInputs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(inputsResource, c.ns, name, opts), &v1alpha1.Input{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeInputs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(inputsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.InputList{}) + return err +} + +// Patch applies the patch and returns the patched input. +func (c *FakeInputs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Input, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(inputsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Input{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Input), err +} diff --git a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fluentd_client.go b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fluentd_client.go index 40a112a83..9d6139163 100644 --- a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fluentd_client.go +++ b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/fluentd_client.go @@ -29,10 +29,12 @@ type FluentdV1alpha1Interface interface { RESTClient() rest.Interface ClusterFiltersGetter ClusterFluentdConfigsGetter + ClusterInputsGetter ClusterOutputsGetter FiltersGetter FluentdsGetter FluentdConfigsGetter + InputsGetter OutputsGetter } @@ -49,6 +51,10 @@ func (c *FluentdV1alpha1Client) ClusterFluentdConfigs() ClusterFluentdConfigInte return newClusterFluentdConfigs(c) } +func (c *FluentdV1alpha1Client) ClusterInputs() ClusterInputInterface { + return newClusterInputs(c) +} + func (c *FluentdV1alpha1Client) ClusterOutputs() ClusterOutputInterface { return newClusterOutputs(c) } @@ -65,6 +71,10 @@ func (c *FluentdV1alpha1Client) FluentdConfigs(namespace string) FluentdConfigIn return newFluentdConfigs(c, namespace) } +func (c *FluentdV1alpha1Client) Inputs(namespace string) InputInterface { + return newInputs(c, namespace) +} + func (c *FluentdV1alpha1Client) Outputs(namespace string) OutputInterface { return newOutputs(c, namespace) } diff --git a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/generated_expansion.go b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/generated_expansion.go index 6ba42f5f1..c7cd806e8 100644 --- a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/generated_expansion.go +++ b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/generated_expansion.go @@ -21,6 +21,8 @@ type ClusterFilterExpansion interface{} type ClusterFluentdConfigExpansion interface{} +type ClusterInputExpansion interface{} + type ClusterOutputExpansion interface{} type FilterExpansion interface{} @@ -29,4 +31,6 @@ type FluentdExpansion interface{} type FluentdConfigExpansion interface{} +type InputExpansion interface{} + type OutputExpansion interface{} diff --git a/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/input.go b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/input.go new file mode 100644 index 000000000..284125181 --- /dev/null +++ b/apis/generated/clientset/versioned/typed/fluentd/v1alpha1/input.go @@ -0,0 +1,194 @@ +/* +Copyright 2022. + +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. +*/ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1" + scheme "github.com/fluent/fluent-operator/v2/apis/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// InputsGetter has a method to return a InputInterface. +// A group's client should implement this interface. +type InputsGetter interface { + Inputs(namespace string) InputInterface +} + +// InputInterface has methods to work with Input resources. +type InputInterface interface { + Create(ctx context.Context, input *v1alpha1.Input, opts v1.CreateOptions) (*v1alpha1.Input, error) + Update(ctx context.Context, input *v1alpha1.Input, opts v1.UpdateOptions) (*v1alpha1.Input, error) + UpdateStatus(ctx context.Context, input *v1alpha1.Input, opts v1.UpdateOptions) (*v1alpha1.Input, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Input, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.InputList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Input, err error) + InputExpansion +} + +// inputs implements InputInterface +type inputs struct { + client rest.Interface + ns string +} + +// newInputs returns a Inputs +func newInputs(c *FluentdV1alpha1Client, namespace string) *inputs { + return &inputs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the input, and returns the corresponding input object, and an error if there is any. +func (c *inputs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Input, err error) { + result = &v1alpha1.Input{} + err = c.client.Get(). + Namespace(c.ns). + Resource("inputs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Inputs that match those selectors. +func (c *inputs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.InputList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.InputList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("inputs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested inputs. +func (c *inputs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("inputs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a input and creates it. Returns the server's representation of the input, and an error, if there is any. +func (c *inputs) Create(ctx context.Context, input *v1alpha1.Input, opts v1.CreateOptions) (result *v1alpha1.Input, err error) { + result = &v1alpha1.Input{} + err = c.client.Post(). + Namespace(c.ns). + Resource("inputs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(input). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a input and updates it. Returns the server's representation of the input, and an error, if there is any. +func (c *inputs) Update(ctx context.Context, input *v1alpha1.Input, opts v1.UpdateOptions) (result *v1alpha1.Input, err error) { + result = &v1alpha1.Input{} + err = c.client.Put(). + Namespace(c.ns). + Resource("inputs"). + Name(input.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(input). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *inputs) UpdateStatus(ctx context.Context, input *v1alpha1.Input, opts v1.UpdateOptions) (result *v1alpha1.Input, err error) { + result = &v1alpha1.Input{} + err = c.client.Put(). + Namespace(c.ns). + Resource("inputs"). + Name(input.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(input). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the input and deletes it. Returns an error if one occurs. +func (c *inputs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("inputs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *inputs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("inputs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched input. +func (c *inputs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Input, err error) { + result = &v1alpha1.Input{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("inputs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_clusterfluentdconfigs.yaml b/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_clusterfluentdconfigs.yaml index b60f7e799..3352aab2b 100644 --- a/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_clusterfluentdconfigs.yaml +++ b/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_clusterfluentdconfigs.yaml @@ -83,6 +83,51 @@ spec: type: object type: object x-kubernetes-map-type: atomic + clusterInputSelector: + description: Select cluster input plugins + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: A label selector requirement is a selector that + contains values, a key, and an operator that relates the key + and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: operator represents a key's relationship to + a set of values. Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of string values. If the + operator is In or NotIn, the values array must be non-empty. + If the operator is Exists or DoesNotExist, the values + array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single + {key,value} in the matchLabels map is equivalent to an element + of matchExpressions, whose key field is "key", the operator + is "In", and the values array contains only "value". The requirements + are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic clusterOutputSelector: description: Select cluster output plugins properties: diff --git a/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_clusterinputs.yaml b/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_clusterinputs.yaml new file mode 100644 index 000000000..179cfe17f --- /dev/null +++ b/charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_clusterinputs.yaml @@ -0,0 +1,876 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.11.3 + creationTimestamp: null + name: clusterinputs.fluentd.fluent.io +spec: + group: fluentd.fluent.io + names: + kind: ClusterInput + listKind: ClusterInputList + plural: clusterinputs + shortNames: + - cfdi + singular: clusterinput + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ClusterInput is the Schema for the clusterinputs 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: ClusterInputSpec defines the desired state of ClusterInput + properties: + inputs: + items: + description: Input defines all available input plugins and their + parameters + properties: + customPlugin: + description: Custom plugin type + properties: + config: + type: string + required: + - config + type: object + forward: + description: in_forward plugin + properties: + addTagPrefix: + description: Adds the prefix to the incoming event's tag. + type: string + bind: + description: The port to listen to, default is "0.0.0.0" + type: string + chunkSizeLimit: + description: The size limit of the received chunk. If the + chunk size is larger than this value, the received chunk + is dropped. + pattern: ^\d+(KB|MB|GB|TB)$ + type: string + chunkSizeWarnLimit: + description: The warning size limit of the received chunk. + If the chunk size is larger than this value, a warning + message will be sent. + pattern: ^\d+(KB|MB|GB|TB)$ + type: string + client: + description: The security section of client plugin + properties: + host: + description: The IP address or hostname of the client. + This is exclusive with Network. + type: string + network: + description: The network address specification. This + is exclusive with Host. + type: string + sharedKey: + description: The shared key per client. + type: string + users: + description: The array of usernames. + type: string + type: object + denyKeepalive: + description: The connections will be disconnected right + after receiving a message, if true. + type: boolean + lingerTimeout: + description: The timeout used to set the linger option. + type: integer + port: + description: The port to listen to, default is 24224. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + resolveHostname: + description: Tries to resolve hostname from IP addresses + or not. + type: boolean + security: + description: The security section of forward plugin + properties: + allowAnonymousSource: + description: Allows the anonymous source. sections + are required, if disabled. + type: string + selfHostname: + description: The hostname. + type: string + sharedKey: + description: The shared key for authentication. + type: string + user: + description: Defines user section directly. + properties: + password: + description: Secret defines the key of a value. + properties: + valueFrom: + description: ValueSource defines how to find + a value's key. + properties: + secretKeyRef: + description: Selects a key of a secret in + the pod's namespace + properties: + key: + description: The key of the secret to + select from. Must be a valid secret + key. + type: string + name: + description: 'Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + username: + description: Secret defines the key of a value. + properties: + valueFrom: + description: ValueSource defines how to find + a value's key. + properties: + secretKeyRef: + description: Selects a key of a secret in + the pod's namespace + properties: + key: + description: The key of the secret to + select from. Must be a valid secret + key. + type: string + name: + description: 'Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + type: object + userAuth: + description: If true, user-based authentication is used. + type: string + type: object + sendKeepalivePacket: + description: Enables the TCP keepalive for sockets. + type: boolean + skipInvalidEvent: + description: Skips the invalid incoming event. + type: boolean + sourceAddressKey: + description: The field name of the client's source address. + If set, the client's address will be set to its key. + type: string + sourceHostnameKey: + description: The field name of the client's hostname. If + set, the client's hostname will be set to its key. + type: string + tag: + description: in_forward uses incoming event's tag by default + (See Protocol Section). If the tag parameter is set, its + value is used instead. + type: string + transport: + description: The transport section of forward plugin + properties: + caCertPath: + description: for Cert generated + type: string + caPath: + description: for Cert signed by public CA + type: string + caPrivateKeyPassphrase: + type: string + caPrivateKeyPath: + type: string + certPath: + type: string + certVerifier: + description: other parameters + type: string + ciphers: + type: string + clientCertAuth: + type: boolean + insecure: + type: boolean + privateKeyPassphrase: + type: string + privateKeyPath: + type: string + protocol: + description: 'The protocal name of this plugin, i.e: + tls' + type: string + version: + type: string + type: object + user: + description: The security section of user plugin + properties: + password: + description: Secret defines the key of a value. + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the + pod's namespace + properties: + key: + description: The key of the secret to select + from. Must be a valid secret key. + type: string + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + username: + description: Secret defines the key of a value. + properties: + valueFrom: + description: ValueSource defines how to find a value's + key. + properties: + secretKeyRef: + description: Selects a key of a secret in the + pod's namespace + properties: + key: + description: The key of the secret to select + from. Must be a valid secret key. + type: string + name: + description: 'Name of the referent. More + info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, + kind, uid?' + type: string + optional: + description: Specify whether the Secret + or its key must be defined + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + type: object + type: object + type: object + http: + description: in_http plugin + properties: + addHttpHeaders: + description: Adds HTTP_ prefix headers to the record. + type: boolean + addRemoteAddr: + description: 'Adds REMOTE_ADDR field to the record. The + value of REMOTE_ADDR is the client''s address. i.e: X-Forwarded-For: + host1, host2' + type: string + bind: + description: The port to listen to, default is "0.0.0.0" + type: string + bodySizeLimit: + description: The size limit of the POSTed element. + pattern: ^\d+(KB|MB|GB|TB)$ + type: string + corsAllOrigins: + description: Whitelist domains for CORS. + type: string + corsAllowCredentials: + description: Add Access-Control-Allow-Credentials header. + It's needed when a request's credentials mode is include + type: string + keepaliveTimeout: + description: The timeout limit for keeping the connection + alive. + pattern: ^\d+(\.[0-9]{0,2})?(s|m|h|d)?$ + type: string + parse: + description: The parse section of http plugin + properties: + customPatternPath: + description: Path to the file that includes custom grok + patterns. + type: string + estimateCurrentEvent: + description: If true, use Fluent::Eventnow(current time) + as a timestamp when time_key is specified. + type: boolean + expression: + description: Specifies the regular expression for matching + logs. Regular expression also supports i and m suffix. + type: string + grok: + description: Grok Sections + items: + properties: + keepTimeKey: + description: If true, keep time field in the record. + type: boolean + name: + description: The name of this grok section. + type: string + pattern: + description: The pattern of grok. Required parameter. + type: string + timeFormat: + description: Process value using specified format. + This is available only when time_type is string + type: string + timeKey: + description: Specify time field for event time. + If the event doesn't have this field, current + time is used. + type: string + timeZone: + description: Use specified timezone. one can parse/format + the time value in the specified timezone. + type: string + type: object + type: array + grokFailureKey: + description: The key has grok failure reason. + type: string + grokPattern: + description: The pattern of grok. + type: string + grokPatternSeries: + description: Specify grok pattern series set. + type: string + id: + description: The @id parameter specifies a unique name + for the configuration. + type: string + keepTimeKey: + description: If true, keep time field in th record. + type: boolean + localtime: + description: If true, uses local time. + type: boolean + logLevel: + description: The @log_level parameter specifies the + plugin-specific logging level + type: string + multiLineStartRegexp: + description: The regexp to match beginning of multiline. + This is only for "multiline_grok". + type: string + timeFormat: + description: Process value according to the specified + format. This is available only when time_type is string + type: string + timeFormatFallbacks: + description: Uses the specified time format as a fallback + in the specified order. You can parse undetermined + time format by using time_format_fallbacks. This options + is enabled when time_type is mixed. + type: string + timeKey: + description: Specify time field for event time. If the + event doesn't have this field, current time is used. + type: string + timeType: + description: parses/formats value according to this + type, default is string + enum: + - float + - unixtime + - string + - mixed + type: string + timeout: + description: Specify timeout for parse processing. + pattern: ^\d+(\.[0-9]{0,2})?(s|m|h|d)?$ + type: string + timezone: + description: Uses the specified timezone. + type: string + type: + description: The @type parameter specifies the type + of the plugin. + enum: + - regexp + - apache2 + - apache_error + - nginx + - syslog + - csv + - tsv + - ltsv + - json + - multiline + - none + - grok + - multiline_grok + type: string + types: + description: 'Specify types for converting field into + another, i.e: types user_id:integer,paid:bool,paid_usd_amount:float' + type: string + utc: + description: If true, uses UTC. + type: boolean + required: + - type + type: object + port: + description: The port to listen to, default is 9880. + format: int32 + maximum: 65535 + minimum: 1 + type: integer + respondsWithEmptyImg: + description: Responds with an empty GIF image of 1x1 pixel + (rather than an empty string). + type: boolean + transport: + description: The transport section of http plugin + properties: + caCertPath: + description: for Cert generated + type: string + caPath: + description: for Cert signed by public CA + type: string + caPrivateKeyPassphrase: + type: string + caPrivateKeyPath: + type: string + certPath: + type: string + certVerifier: + description: other parameters + type: string + ciphers: + type: string + clientCertAuth: + type: boolean + insecure: + type: boolean + privateKeyPassphrase: + type: string + privateKeyPath: + type: string + protocol: + description: 'The protocal name of this plugin, i.e: + tls' + type: string + version: + type: string + type: object + type: object + id: + description: The @id parameter specifies a unique name for the + configuration. + type: string + label: + description: The @label parameter is to route the input events + to