-
Notifications
You must be signed in to change notification settings - Fork 141
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
upgrade es and kb to version 8 #3598
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ import ( | |
"github.com/tigera/operator/pkg/common" | ||
"github.com/tigera/operator/pkg/components" | ||
"github.com/tigera/operator/pkg/dns" | ||
"github.com/tigera/operator/pkg/ptr" | ||
relasticsearch "github.com/tigera/operator/pkg/render/common/elasticsearch" | ||
rmeta "github.com/tigera/operator/pkg/render/common/meta" | ||
"github.com/tigera/operator/pkg/render/common/networkpolicy" | ||
|
@@ -358,15 +359,10 @@ func (es *elasticsearchComponent) podTemplate() corev1.PodTemplateSpec { | |
}, | ||
} | ||
|
||
sc := securitycontext.NewRootContext(false) | ||
// These capabilities are required for docker-entrypoint.sh. | ||
// See: https://github.com/elastic/elasticsearch/blob/7.17/distribution/docker/src/docker/bin/docker-entrypoint.sh. | ||
// TODO Consider removing for Elasticsearch v8+. | ||
sc.Capabilities.Add = []corev1.Capability{ | ||
"SETGID", | ||
"SETUID", | ||
"SYS_CHROOT", | ||
} | ||
sc := securitycontext.NewNonRootContext() | ||
// Set the user and group to be the default elasticsearch ID | ||
sc.RunAsUser = ptr.Int64ToPtr(1000) | ||
sc.RunAsGroup = ptr.Int64ToPtr(1000) | ||
|
||
esContainer := corev1.Container{ | ||
Name: "elasticsearch", | ||
|
@@ -717,9 +713,12 @@ func (es *elasticsearchComponent) nodeSets() []esv1.NodeSet { | |
// NodeSet | ||
func (es *elasticsearchComponent) nodeSetTemplate(pvcTemplate corev1.PersistentVolumeClaim) esv1.NodeSet { | ||
config := map[string]interface{}{ | ||
"node.master": "true", | ||
"node.data": "true", | ||
"node.ingest": "true", | ||
"node.roles": []string{ | ||
"data", | ||
"ingest", | ||
"master", | ||
"remote_cluster_client", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we remove this role? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might need these role - data, ingest, master same as the previous version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :/ so be it... |
||
}, | ||
"cluster.max_shards_per_node": 10000, | ||
// Disable geoip downloader. This removes an error from the startup logs, because our network policy blocks it. | ||
"ingest.geoip.downloader.enabled": false, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, the init containers still need to run as root to:
and so the namespace still needs to have the privileged context. The main container now runs as 1000:1000, which is the es user. This is also the user the prepareFS script will chown to.
Is my understanding correct? Have we considered changing the user to 10000:10000 (our default user)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this SecurityContext is for the main ElasticSearch container. The SecurityContext for each init container still uses the root context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Init container "elastic-internal-init-filesystem" still run as root because we need to set the vm max map count "echo 262144 > /proc/sys/vm/max_map_count". This change is only for elasticsearch container.
Currently, Elasticsearch 7, we override the security context of the Elasticsearch container to run as the root user and group. The docker-entrypoint.sh script in Elasticsearch contained logic to switch to user 1000 when it encountered a root user. However, this logic has been removed in Elasticsearch 8. Since the ownership of the /data folder is set to the default Elasticsearch UID, we are encountering an unwritable error when running as the root user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We spoke offline about a potential follow-up to explore using uid:gid of 10001:10001, but continue with the PR in its current form.