Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/elasticsearch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func sendEsRequest(cluster, namespace string, payload *EsRequest, client k8sclie
// TODO: eventually remove after all ES images have been updated to use SA token auth for EO?
if resp.StatusCode == http.StatusForbidden ||
resp.StatusCode == http.StatusUnauthorized {
log.Info("failed sending payload using bearer token", "method", payload.Method, "url", payload.URI)
// if we get a 401 that means that we couldn't read from the token and provided
// no header.
// if we get a 403 that means the ES cluster doesn't allow us to use
Expand Down Expand Up @@ -252,6 +253,10 @@ func sendRequestWithMTlsClient(clusterName, namespace string, payload *EsRequest
resp, err := httpClient.Do(request)

if resp != nil {
if resp.StatusCode == http.StatusForbidden || resp.StatusCode == http.StatusUnauthorized {
log.Info("failed sending payload using mTLS PKI", "method", payload.Method, "url", payload.URI)
}

payload.StatusCode = resp.StatusCode
if payload.RawResponseBody, err = getRawBody(resp.Body); err != nil {
log.Error(err, "failed to get raw response body")
Expand Down
2 changes: 1 addition & 1 deletion pkg/elasticsearch/replicas.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (ec *esClient) updateAllIndexReplicas(replicaCount int32) (bool, error) {
func (ec *esClient) GetIndexReplicaCounts() (map[string]interface{}, error) {
payload := &EsRequest{
Method: http.MethodGet,
URI: "*/_settings/index.number_of_replicas",
URI: "app-*,infra-*,audit-*/_settings/index.number_of_replicas",
}

ec.fnSendEsRequest(ec.cluster, ec.namespace, payload, ec.k8sClient)
Expand Down