Skip to content

Make is_ready container-image configurable #2593

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions docs/howto/custom_images.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The current images that could be overwritten are:
| Kibana | KIBANA_IMAGE_REF_OVERRIDE | kibana |
| Elastic Agent | ELASTIC_AGENT_IMAGE_REF_OVERRIDE | elastic-agent |
| Logstash | LOGSTASH_IMAGE_REF_OVERRIDE | logstash |
| is_ready | IS_READY_IMAGE_REF_OVERRIDE | is_ready |


For the following two examples, it will be used as example overwriting elastic-agent image.
Expand Down
5 changes: 5 additions & 0 deletions internal/install/application_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
elasticsearchImageName = "docker.elastic.co/elasticsearch/elasticsearch"
kibanaImageName = "docker.elastic.co/kibana/kibana"
logstashImageName = "docker.elastic.co/logstash/logstash"
isreadyImageName = "tianon/true:multiarch"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit.

Suggested change
isreadyImageName = "tianon/true:multiarch"
isReadyImageName = "tianon/true:multiarch"


applicationConfigurationYmlFile = "config.yml"
)
Expand Down Expand Up @@ -101,6 +102,7 @@ func (s stack) ImageRefOverridesForVersion(version string) ImageRefs {
Elasticsearch: checkImageRefOverride("ELASTICSEARCH_IMAGE_REF_OVERRIDE", stringOrDefault(appConfigImageRefs.Elasticsearch, "")),
Kibana: checkImageRefOverride("KIBANA_IMAGE_REF_OVERRIDE", stringOrDefault(appConfigImageRefs.Kibana, "")),
Logstash: checkImageRefOverride("LOGSTASH_IMAGE_REF_OVERRIDE", stringOrDefault(appConfigImageRefs.Logstash, "")),
is_ready: checkImageRefOverride("IS_READY_IMAGE_REF_OVERRIDE", stringOrDefault(appConfigImageRefs.is_ready, "")),
}
}

Expand All @@ -110,6 +112,7 @@ type ImageRefs struct {
Elasticsearch string `yaml:"elasticsearch"`
Kibana string `yaml:"kibana"`
Logstash string `yaml:"logstash"`
is_ready string `yaml:"is_ready"`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
is_ready string `yaml:"is_ready"`
IsReady string `yaml:"is_ready"`

}

// AsEnv method returns key=value representation of image refs.
Expand All @@ -119,6 +122,7 @@ func (ir ImageRefs) AsEnv() []string {
vars = append(vars, "ELASTICSEARCH_IMAGE_REF="+ir.Elasticsearch)
vars = append(vars, "KIBANA_IMAGE_REF="+ir.Kibana)
vars = append(vars, "LOGSTASH_IMAGE_REF="+ir.Logstash)
vars = append(vars, "IS_READY_IMAGE_REF="+ir.is_ready)
return vars
}

Expand All @@ -129,6 +133,7 @@ func (ac *ApplicationConfiguration) StackImageRefs() ImageRefs {
refs.Elasticsearch = stringOrDefault(refs.Elasticsearch, fmt.Sprintf("%s:%s", elasticsearchImageName, ac.stackVersion))
refs.Kibana = stringOrDefault(refs.Kibana, fmt.Sprintf("%s:%s", kibanaImageName, ac.stackVersion))
refs.Logstash = stringOrDefault(refs.Logstash, fmt.Sprintf("%s:%s", logstashImageName, ac.stackVersion))
refs.is_ready = stringOrDefault(refs.is_ready, isreadyImageName)
return refs
}

Expand Down
12 changes: 6 additions & 6 deletions internal/stack/_static/docker-compose-stack.yml.tmpl
Copy link
Member

Choose a reason for hiding this comment

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

Please review other compose files in this directory that may be using this image.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
- "127.0.0.1:9200:9200"

elasticsearch_is_ready:
image: tianon/true:multiarch
image: "${IS_READY_IMAGE_REF}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be updated also the docker-compose for local services ?
https://github.com/elastic/elastic-package/blob/f00e430124b1e8bb43f234fcc7e756461a107786/internal/stack/_static/local-services-docker-compose.yml.tmpl

To use that environment variable, this file uses facts instead. Here it is the method where those facts are set:

"logstash_image": imageRefs.Logstash,

depends_on:
elasticsearch:
condition: service_healthy
Expand Down Expand Up @@ -57,7 +57,7 @@ services:
- "127.0.0.1:5601:5601"

kibana_is_ready:
image: tianon/true:multiarch
image: "${IS_READY_IMAGE_REF}"
depends_on:
kibana:
condition: service_healthy
Expand Down Expand Up @@ -89,7 +89,7 @@ services:
- "127.0.0.1:9000:9000"

package-registry_is_ready:
image: tianon/true:multiarch
image: "${IS_READY_IMAGE_REF}"
depends_on:
package-registry:
condition: service_healthy
Expand Down Expand Up @@ -130,7 +130,7 @@ services:
{{ end }}

fleet-server_is_ready:
image: tianon/true:multiarch
image: "${IS_READY_IMAGE_REF}"
depends_on:
fleet-server:
condition: service_healthy
Expand Down Expand Up @@ -162,7 +162,7 @@ services:
target: /run/service_logs/

elastic-agent_is_ready:
image: tianon/true:multiarch
image: "${IS_READY_IMAGE_REF}"
depends_on:
elastic-agent:
condition: service_healthy
Expand Down Expand Up @@ -195,7 +195,7 @@ services:
- ELASTIC_HOSTS=https://127.0.0.1:9200

logstash_is_ready:
image: tianon/true:multiarch
image: "${IS_READY_IMAGE_REF}"
depends_on:
logstash:
condition: service_healthy
Expand Down