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

[Backport] Remove process manager (#1249) #1260

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 5 additions & 1 deletion docs/design/0011-process-manager.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# 11. Process manager for keystore update and Elasticsearch restart

* Status: proposed
* Status: rejected (implementation removed) in July 2019. The keystore updater is moved into an init container to adopt the same
pattern used for Kibana and APM server. With the move towards the StatefulSet way of doing rolling restarts, we no longer need a
process manager to perform Elasticsearch cluster restart. The zombie reaping problem only exists when another process is started
in the container (e.g. kubectl exec) and should probably be handled in the official images.
Main benefits are code and architecture simplicity as well as respecting k8s standards.
* Deciders: cloud-on-k8s team
* Date: 2019-05-28

Expand Down
4 changes: 1 addition & 3 deletions operators/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build \
-ldflags "$GO_LDFLAGS" -tags="$GO_TAGS" -a \
-o elastic-operator github.com/elastic/cloud-on-k8s/operators/cmd
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags="$GO_TAGS" -a -o process-manager github.com/elastic/cloud-on-k8s/operators/cmd/process-manager

# Copy the controller-manager and the process-manager into a thin image
# Copy the controller-manager into a thin image
FROM centos:7

RUN set -x \
Expand All @@ -29,6 +28,5 @@ WORKDIR /eck
USER 101

COPY --from=builder /go/src/github.com/elastic/cloud-on-k8s/operators/elastic-operator .
COPY --from=builder /go/src/github.com/elastic/cloud-on-k8s/operators/process-manager .
ENTRYPOINT ["./elastic-operator"]
CMD ["manager"]
29 changes: 4 additions & 25 deletions operators/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ OPERATOR_IMAGE ?= $(IMG):$(VERSION)-$(TAG)
ifeq ($(SNAPSHOT_RELEASE), false)
OPERATOR_IMAGE = $(IMG):$(TAG)
endif
OPERATOR_IMAGE_LATEST ?= $(IMG):latest

GO_LDFLAGS := -X github.com/elastic/cloud-on-k8s/operators/pkg/about.version=$(VERSION) \
-X github.com/elastic/cloud-on-k8s/operators/pkg/about.buildHash=$(TAG) \
Expand Down Expand Up @@ -71,7 +70,7 @@ PSP ?= 0
## -- Development -- ##
#####################################

all: dep-vendor-only unit integration e2e-compile check-fmt elastic-operator process-manager check-license-header
all: dep-vendor-only unit integration e2e-compile check-fmt elastic-operator check-license-header

## -- build

Expand All @@ -91,9 +90,6 @@ generate:
elastic-operator: generate
go build -ldflags "$(GO_LDFLAGS)" -tags='$(GO_TAGS)' -o bin/elastic-operator github.com/elastic/cloud-on-k8s/operators/cmd

process-manager:
go build -tags='$(GO_TAGS)' -o bin/process-manager github.com/elastic/cloud-on-k8s/operators/cmd/process-manager

fmt:
goimports -w pkg cmd

Expand Down Expand Up @@ -132,7 +128,7 @@ run: install-crds go-run

go-run:
# Run the operator locally with role All, with debug logs, operator image set to latest and operator namespace for a global operator
AUTO_PORT_FORWARD=true OPERATOR_IMAGE=$(OPERATOR_IMAGE_LATEST) \
AUTO_PORT_FORWARD=true \
go run \
-ldflags "$(GO_LDFLAGS)" \
-tags "$(GO_TAGS)" \
Expand Down Expand Up @@ -223,7 +219,7 @@ set-context-minikube:

bootstrap-minikube:
hack/minikube-cluster.sh
$(MAKE) set-context-minikube registry lazy-push-latest-operator-image-in-local-registry cluster-bootstrap
$(MAKE) set-context-minikube cluster-bootstrap

## -- gke

Expand All @@ -247,29 +243,12 @@ ifeq ($(PSP), 1)
endif
ifeq ($(SKIP_DOCKER_COMMAND), false)
# push "latest" operator image to be used for init containers when running the operator locally
$(MAKE) docker-build docker-push OPERATOR_IMAGE=$(OPERATOR_IMAGE_LATEST)
$(MAKE) docker-build docker-push
endif

delete-gke: require-gcloud-project
GKE_CLUSTER_VERSION=$(GKE_CLUSTER_VERSION) ./hack/gke-cluster.sh delete

## -- registry in the cluster

registry:
@ echo "-> Deploying registry..."
@ hack/registry.sh create

lazy-push-latest-operator-image-in-local-registry:
@ hack/registry.sh port-forward start
@ docker pull $(OPERATOR_IMAGE_LATEST) || $(MAKE) docker-build docker-push OPERATOR_IMAGE=$(OPERATOR_IMAGE_LATEST)
@ hack/registry.sh port-forward stop

force-push-latest-operator-image-in-local-registry:
@ hack/registry.sh port-forward start
@ $(MAKE) docker-build docker-push OPERATOR_IMAGE=$(OPERATOR_IMAGE_LATEST)
@ hack/registry.sh port-forward stop


#################################
## -- Docker images -- ##
#################################
Expand Down
13 changes: 0 additions & 13 deletions operators/cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ func init() {
"",
"namespace in which this operator should manage resources (defaults to all namespaces)",
)
Cmd.Flags().String(
operator.ImageFlag,
"",
"image containing the binaries for this operator",
)
Cmd.Flags().Bool(
AutoPortForwardFlagName,
false,
Expand Down Expand Up @@ -183,13 +178,6 @@ func execute() {
dialer = portforward.NewForwardingDialer()
}

operatorImage := viper.GetString(operator.ImageFlag)
if operatorImage == "" {
log.Error(fmt.Errorf("%s is a required flag", operator.ImageFlag),
"required configuration missing")
os.Exit(1)
}

operatorNamespace := viper.GetString(OperatorNamespaceFlag)
if operatorNamespace == "" {
log.Error(fmt.Errorf("%s is a required flag", OperatorNamespaceFlag),
Expand Down Expand Up @@ -259,7 +247,6 @@ func execute() {
log.Info("Setting up controllers", "roles", roles)
if err := controller.AddToManager(mgr, roles, operator.Parameters{
Dialer: dialer,
OperatorImage: operatorImage,
OperatorNamespace: operatorNamespace,
OperatorInfo: operatorInfo,
CACertRotation: certificates.RotationParams{
Expand Down
94 changes: 0 additions & 94 deletions operators/cmd/process-manager/README.md

This file was deleted.

101 changes: 0 additions & 101 deletions operators/cmd/process-manager/flags.go

This file was deleted.

Loading