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

feature: add worker image pull secret name #273

Merged
merged 2 commits into from
Mar 26, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public class Configuration {
*/
private String serviceAccountName;

/**
* The name of image pull secret
*/
private String imagePullSecretName;

/**
* The container image of elastic workers.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.kubernetes.client.openapi.models.V1ContainerStatus;
import io.kubernetes.client.openapi.models.V1EnvVar;
import io.kubernetes.client.openapi.models.V1HTTPGetAction;
import io.kubernetes.client.openapi.models.V1LocalObjectReference;
import io.kubernetes.client.openapi.models.V1ObjectMeta;
import io.kubernetes.client.openapi.models.V1PersistentVolumeClaimVolumeSource;
import io.kubernetes.client.openapi.models.V1Pod;
Expand Down Expand Up @@ -125,6 +126,13 @@ public void scheduleAsync(long identity, long requestedMemSize, BiConsumer<Strin
V1PodSpec podSpec = new V1PodSpec().addContainersItem(container).addVolumesItem(volume)
.serviceAccountName(config.getServiceAccountName())
.restartPolicy("Never");

String imagePullSecretName = config.getImagePullSecretName();
if (StringUtils.isNotBlank(imagePullSecretName)) {
podSpec.addImagePullSecretsItem(new V1LocalObjectReference()
.name(imagePullSecretName));
}

// workaround for https://github.com/kubernetes-client/java/issues/3076
podSpec.setOverhead(null);
pod.spec(podSpec);
Expand Down
10 changes: 9 additions & 1 deletion site/docs/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ Type: String

Default: null

## image-pull-secret-name

The name of image pull secret

Type: String

Default: null

## elastic-worker-image

Docker image used in the cluster to run `ELASTIC_WORKER` nodes.
Expand Down Expand Up @@ -169,4 +177,4 @@ Local files to be analyzed, used only in `STANDALONE_WORKER` role.

Type: Path[]

Default: null
Default: null
10 changes: 9 additions & 1 deletion site/docs/zh/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@

默认值: null

## image-pull-secret-name

集群中用于拉取 `WORKER` 镜像的密钥的名字。

类型: String

默认值: null

## elastic-worker-image

集群中用于运行 `WORKER` 节点的镜像。
Expand Down Expand Up @@ -167,4 +175,4 @@ Default: false

类型:Path[]

默认值:null
默认值:null
Loading