-
Notifications
You must be signed in to change notification settings - Fork 5k
fix: solaris build compatibility #45105
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
c189d74
fix: solaris build compatibility
gaige 0b5f406
Merge branch 'main' into solaris
gaige b071da7
Merge branch 'main' into solaris
gaige c6d2e17
Merge branch 'main' into solaris
gaige 4771d6b
fix: add comment per request
gaige 81644ab
fix: per requsts and formats
gaige d0fae2b
fix: per requsts and formats
gaige 935e7ca
fix: remove unnecesary kubernetes stub
gaige 0b633f5
fix: synchronize build directives
gaige 6d4e06f
Merge branch 'main' into solaris
gaige e6aef0a
fix: constrain docker tests to linux,darwin,windows
gaige 234768e
Merge branch 'main' into solaris
gaige 3c8c0c0
fix: linter errors
gaige 09bc5e2
fix: update lint fix
gaige e08d4b3
Merge branch 'main' into solaris
gaige 8d70f0b
fix: add comments
gaige a942588
fix: lint and compile issue from math
gaige eac880b
fix: update more lint
gaige c470455
fix: fix lint
gaige d28b6cc
fix: more lint
gaige a0b0e95
Merge branch 'main' into solaris
gaige e122b8e
fix: more linting response
gaige f0e47ae
fix: linter
gaige File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
libbeat/autodiscover/providers/kubernetes/kubernetes_stub.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you 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. | ||
|
||
//go:build aix || solaris | ||
gaige marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
package kubernetes | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gofrs/uuid" | ||
|
||
"github.com/elastic/beats/v7/libbeat/autodiscover" | ||
"github.com/elastic/elastic-agent-autodiscover/bus" | ||
"github.com/elastic/elastic-agent-autodiscover/kubernetes" | ||
"github.com/elastic/elastic-agent-libs/config" | ||
"github.com/elastic/elastic-agent-libs/keystore" | ||
"github.com/elastic/elastic-agent-libs/logp" | ||
"github.com/elastic/elastic-agent-libs/mapstr" | ||
) | ||
|
||
func init() { | ||
err := autodiscover.Registry.AddProvider("kubernetes", AutodiscoverBuilder) | ||
if err != nil { | ||
logp.Error(fmt.Errorf("could not add `hints` builder")) | ||
} | ||
} | ||
|
||
// Eventer allows defining ways in which kubernetes resource events are observed and processed | ||
type Eventer interface { | ||
kubernetes.ResourceEventHandler | ||
GenerateHints(event bus.Event) bus.Event | ||
Start() error | ||
Stop() | ||
} | ||
|
||
// EventManager allows defining ways in which kubernetes resource events are observed and processed | ||
type EventManager interface { | ||
GenerateHints(event bus.Event) bus.Event | ||
Start() | ||
Stop() | ||
} | ||
|
||
// Provider implements autodiscover provider for docker containers | ||
type Provider struct { | ||
logger *logp.Logger | ||
} | ||
|
||
// AutodiscoverBuilder builds and returns an autodiscover provider | ||
func AutodiscoverBuilder( | ||
beatName string, | ||
bus bus.Bus, | ||
uuid uuid.UUID, | ||
c *config.C, | ||
keystore keystore.Keystore, | ||
) (autodiscover.Provider, error) { | ||
logger := logp.NewLogger("autodiscover") | ||
|
||
p := &Provider{ | ||
logger: logger, | ||
} | ||
|
||
return p, nil | ||
} | ||
|
||
// Start for Runner interface. | ||
func (p *Provider) Start() { | ||
} | ||
|
||
// Stop signals the stop channel to force the watch loop routine to stop. | ||
func (p *Provider) Stop() { | ||
} | ||
|
||
// String returns a description of kubernetes autodiscover provider. | ||
func (p *Provider) String() string { | ||
return "kubernetes" | ||
} | ||
|
||
func (p *Provider) publish(events []bus.Event) { | ||
if len(events) == 0 { | ||
return | ||
} | ||
|
||
} | ||
|
||
func ShouldPut(event mapstr.M, field string, value interface{}, logger *logp.Logger) { | ||
_, err := event.Put(field, value) | ||
if err != nil { | ||
logger.Debugf("Failed to put field '%s' with value '%s': %s", field, value, err) | ||
} | ||
} | ||
|
||
func ShouldDelete(event mapstr.M, field string, logger *logp.Logger) { | ||
err := event.Delete(field) | ||
if err != nil { | ||
logger.Debugf("Failed to delete field '%s': %s", field, err) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.