Skip to content

Instantly share code, notes, and snippets.

@jmervine
Created December 19, 2018 21:21
Show Gist options
  • Select an option

  • Save jmervine/5c0cdf69664be7275e2bc17c84bdf50c to your computer and use it in GitHub Desktop.

Select an option

Save jmervine/5c0cdf69664be7275e2bc17c84bdf50c to your computer and use it in GitHub Desktop.

Revisions

  1. jmervine created this gist Dec 19, 2018.
    30 changes: 30 additions & 0 deletions update.mk
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@

    UPDATE_TYPE ?= sts
    STS ?=

    indexers: ## Select indexer as actionable StatefultSet
    indexers:
    $(eval STS := indexer)
    @echo "Set indexer as actionable StatefulSet"

    indexer: indexers
    index: indexers

    searchers: ## Select search as actionable StatefultSet
    searchers:
    $(eval STS := search)
    @echo "Set search as actionable StatefulSet"

    searcher: searchers
    search: searchers

    update: ## Perform rolling update on selected actionable StatefulSet
    update:
    @if test -z "$(STS)"; then \
    echo "ERROR: Please provide a StatefulSet to update: 'make <sts> update'."; \
    else \
    echo "kubectl patch $(UPDATE_TYPE) $(STS) -p '{\"spec\":{\"updateStrategy\":{\"type\":\"RollingUpdate\"}}}'"; \
    kubectl patch $(UPDATE_TYPE) $(STS) -p '{"spec":{"updateStrategy":{"type":"RollingUpdate"}}}'; \
    fi

    .PHONY: indexers indexer index searchers searcher search update