Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for elasticSearch typeless API #387

Merged

Conversation

guipal
Copy link
Contributor

@guipal guipal commented Jan 8, 2024

Support for elastic search typeless API

Problem

As described in elastic docs. Starting from elastic version 8.0 APIs that accept types are removed and a new endpoint needs to be called.

Proposed Solution

Introduce a new configuration variable to enable usage of new endpoint to send data when using ES>8.0

@guipal guipal force-pushed the fix/fix-elasticSearch-target-integration branch from c821e0f to bfadc55 Compare January 8, 2024 12:24
@guipal
Copy link
Contributor Author

guipal commented Jan 8, 2024

Hello fjogeleit another minor change for elasticSearch compatibility. Not bumping helm chart just in case you wanna include something else. Thankyou!

@fjogeleit
Copy link
Member

Hey @guipal, thanks for the contribution. I will check and the missing bump is fine.

@@ -30,13 +30,14 @@ elasticsearch:
skipTLS: {{ .Values.target.elasticsearch.skipTLS }}
username: {{ .Values.target.elasticsearch.username | quote }}
password: {{ .Values.target.elasticsearch.password | quote }}
apiKey: {{ .Values.target.elasticsearch.password | quote }}
apiKey: {{ .Values.target.elasticsearch.apiKey | quote }}
Copy link
Member

Choose a reason for hiding this comment

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

good catch 👍

@@ -76,12 +88,16 @@ func (e *client) Send(result v1alpha2.PolicyReportResult) {
return
}

zap.L().Info("ElasticSearch ApiKey" + e.apiKey)
Copy link
Member

Choose a reason for hiding this comment

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

I think this was for debugging and should be removed now

if e.username != "" {
req.SetBasicAuth(e.username, e.password)
} else if e.apiKey != "" {
req.Header.Add("Authorization", "ApiKey "+e.apiKey)
}

zap.L().Info("ElasticSearch Authorization Header" + req.Header.Get("Authorization"))
Copy link
Member

Choose a reason for hiding this comment

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

Same here

@fjogeleit fjogeleit merged commit c73670a into kyverno:main Jan 8, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants