Skip to content

Commit

Permalink
Merge pull request #1 from openshift/master
Browse files Browse the repository at this point in the history
rebase from origin/master
  • Loading branch information
bmillemathias-1a authored Mar 3, 2020
2 parents ae262cc + 5f3ff65 commit d40ca73
Show file tree
Hide file tree
Showing 126 changed files with 5,976 additions and 1,011 deletions.
Empty file added .zz_generate_timestamp
Empty file.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ COPY . .
RUN make

FROM centos:centos7
ARG CSV=4.4
RUN INSTALL_PKGS=" \
openssl \
" && \
Expand All @@ -17,7 +16,7 @@ COPY --from=builder _output/bin/cluster-logging-operator /usr/bin/
COPY scripts/* /usr/bin/scripts/
RUN mkdir -p /usr/share/logging/
COPY files/ /usr/share/logging/
COPY manifests/$CSV /manifests/$CSV
COPY manifests/4* /manifests/
COPY manifests/cluster-logging.package.yaml /manifests/
# this is required because the operator invokes a script as `bash scripts/cert_generation.sh`
WORKDIR /usr/bin
Expand Down
8 changes: 6 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 44 additions & 45 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
CURPATH=$(PWD)
TARGET_DIR=$(CURPATH)/_output
TARGET_DIR=$(CURDIR)/_output
KUBECONFIG?=$(HOME)/.kube/config

GOBUILD=go build
BUILD_GOPATH=$(TARGET_DIR):$(TARGET_DIR)/vendor:$(CURPATH)/cmd
BUILD_GOPATH=$(TARGET_DIR):$(TARGET_DIR)/vendor:$(CURDIR)/cmd

IMAGE_BUILDER_OPTS=
IMAGE_BUILDER?=imagebuilder
Expand All @@ -16,11 +15,10 @@ TARGET=$(TARGET_DIR)/bin/$(APP_NAME)
IMAGE_TAG?=quay.io/openshift/origin-$(APP_NAME):latest
export IMAGE_TAG
MAIN_PKG=cmd/manager/main.go
export OCP_VERSION?=4.4
IMAGE_CLUSTER_LOGGING_OPERATOR?=registry.svc.ci.openshift.org/origin/$(VERSION):cluster-logging-operator
export CSV_FILE=$(CURPATH)/manifests/$(OCP_VERSION)/cluster-logging.v$(OCP_VERSION).0.clusterserviceversion.yaml
export OCP_VERSION?=$(shell basename $(shell find manifests/ -maxdepth 1 -not -name manifests -type d))
export CSV_FILE=$(CURDIR)/manifests/$(OCP_VERSION)/cluster-logging.v$(OCP_VERSION).0.clusterserviceversion.yaml
export NAMESPACE?=openshift-logging
export EO_CSV_FILE=$(CURPATH)/vendor/github.com/openshift/elasticsearch-operator/manifests/$(OCP_VERSION)/elasticsearch-operator.v$(OCP_VERSION).0.clusterserviceversion.yaml
export EO_CSV_FILE=$(CURDIR)/vendor/github.com/openshift/elasticsearch-operator/manifests/$(OCP_VERSION)/elasticsearch-operator.v$(OCP_VERSION).0.clusterserviceversion.yaml

FLUENTD_IMAGE?=quay.io/openshift/origin-logging-fluentd:latest

Expand All @@ -29,56 +27,43 @@ TEST_PKGS=$(shell go list ./test)

TEST_OPTIONS?=

OC?=oc
# go source files, excluding generated code.
SRC = $(shell find cmd pkg version -type f -name '*.go' -not -name zz_generated*)

# These will be provided to the target
#VERSION := 1.0.0
#BUILD := `git rev-parse HEAD`

# Use linker flags to provide version/build settings to the target
#LDFLAGS=-ldflags "-X=main.Version=$(VERSION) -X=main.Build=$(BUILD)"

# go source files, ignore vendor directory
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")

#.PHONY: all build clean install uninstall fmt simplify check run
.PHONY: all operator-sdk imagebuilder build clean fmt simplify gendeepcopy deploy-setup deploy-image deploy deploy-example test-unit test-e2e test-sec undeploy run
.PHONY: all imagebuilder build clean fmt simplify generate deploy-setup deploy-image deploy deploy-example test-unit test-e2e test-sec undeploy run

all: build #check install

operator-sdk:
@if ! type -p operator-sdk ; \
then if [ ! -d $(GOPATH)/src/github.com/operator-framework/operator-sdk ] ; \
then git clone https://github.com/operator-framework/operator-sdk --branch master $(GOPATH)/src/github.com/operator-framework/operator-sdk ; \
fi ; \
cd $(GOPATH)/src/github.com/operator-framework/operator-sdk ; \
make dep ; \
make install || sudo make install || cd commands/operator-sdk && sudo go install ; \
fi
# Download a known released version of operator-sdk.
OPERATOR_SDK_RELEASE?=v0.15.2
OPERATOR_SDK=./operator-sdk-$(OPERATOR_SDK_RELEASE)
$(OPERATOR_SDK):
curl -f -L -o $@ https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_RELEASE}/operator-sdk-${OPERATOR_SDK_RELEASE}-$(shell uname -i)-linux-gnu
chmod +x $(OPERATOR_SDK)

imagebuilder:
@if [ $${USE_IMAGE_STREAM:-false} = false ] && ! type -p imagebuilder ; \
then go get -u github.com/openshift/imagebuilder/cmd/imagebuilder ; \
fi

build: fmt
build: generate fmt
@mkdir -p $(TARGET_DIR)/src/$(APP_REPO)
@cp -ru $(CURPATH)/pkg $(TARGET_DIR)/src/$(APP_REPO)
@cp -ru $(CURPATH)/vendor/* $(TARGET_DIR)/src
@GOPATH=$(BUILD_GOPATH) $(GOBUILD) $(LDFLAGS) -o $(TARGET) $(MAIN_PKG)
@cp -ru $(CURDIR)/pkg $(TARGET_DIR)/src/$(APP_REPO)
@cp -ru $(CURDIR)/vendor/* $(TARGET_DIR)/src
GOPATH=$(BUILD_GOPATH) $(GOBUILD) $(LDFLAGS) -o $(TARGET) $(MAIN_PKG)

run:
ELASTICSEARCH_IMAGE=quay.io/openshift/origin-logging-elasticsearch5:latest \
ELASTICSEARCH_IMAGE=quay.io/openshift/origin-logging-elasticsearch6:latest \
FLUENTD_IMAGE=$(FLUENTD_IMAGE) \
KIBANA_IMAGE=quay.io/openshift/origin-logging-kibana5:latest \
CURATOR_IMAGE=quay.io/openshift/origin-logging-curator5:latest \
KIBANA_IMAGE=quay.io/openshift/origin-logging-kibana6:latest \
CURATOR_IMAGE=quay.io/openshift/origin-logging-curator6:latest \
OAUTH_PROXY_IMAGE=quay.io/openshift/origin-oauth-proxy:latest \
PROMTAIL_IMAGE=quay.io/openshift/origin-promtail:latest \
OPERATOR_NAME=cluster-logging-operator \
WATCH_NAMESPACE=openshift-logging \
KUBERNETES_CONFIG=$(KUBECONFIG) \
WORKING_DIR=$(TARGET_DIR)/ocp-clo \
LOGGING_SHARE_DIR=$(CURPATH)/files \
LOGGING_SHARE_DIR=$(CURDIR)/files \
go run ${MAIN_PKG}

clean:
Expand All @@ -91,25 +76,35 @@ image: imagebuilder
fi

lint:
@golangci-lint run -c golangci.yaml
golangci-lint run -c golangci.yaml

fmt:
@gofmt -l -w cmd/ pkg/ version/
gofmt -l -w cmd/ pkg/ version/

simplify:
@gofmt -s -l -w $(SRC)
gofmt -s -l -w $(SRC)

GEN_TIMESTAMP=.zz_generate_timestamp
generate: $(GEN_TIMESTAMP)
$(GEN_TIMESTAMP): $(SRC) $(OPERATOR_SDK)
$(OPERATOR_SDK) generate k8s
$(OPERATOR_SDK) generate crds
@touch $@

gendeepcopy: operator-sdk
@operator-sdk generate k8s
# spotless does make clean and removes generated code. Don't commit without re-generating.
spotless: clean
@find pkg -name 'zz_generated*' -delete -print
@rm -vrf deploy/crds/*.yaml
@rm -vf $(GEN_TIMESTAMP)

deploy-image: image
hack/deploy-image.sh

deploy: deploy-image deploy-elasticsearch-operator
IMAGE_CLUSTER_LOGGING_OPERATOR=$(IMAGE_CLUSTER_LOGGING_OPERATOR) hack/deploy.sh
hack/deploy.sh

deploy-no-build: deploy-elasticsearch-operator
IMAGE_CLUSTER_LOGGING_OPERATOR=$(IMAGE_CLUSTER_LOGGING_OPERATOR) hack/deploy.sh
hack/deploy.sh

deploy-elasticsearch-operator:
hack/deploy-eo.sh
Expand All @@ -118,11 +113,15 @@ deploy-example: deploy
oc create -n $(NAMESPACE) -f hack/cr.yaml

test-unit: fmt
@LOGGING_SHARE_DIR=$(CURPATH)/files go test $(TEST_OPTIONS) $(PKGS)
@LOGGING_SHARE_DIR=$(CURDIR)/files go test $(TEST_OPTIONS) $(PKGS)

test-e2e:
hack/test-e2e.sh

test-e2e-local: deploy-image
IMAGE_CLUSTER_LOGGING_OPERATOR=image-registry.openshift-image-registry.svc:5000/openshift/origin-cluster-logging-operator:latest \
hack/test-e2e.sh

test-sec:
go get -u github.com/securego/gosec/cmd/gosec
gosec -severity medium --confidence medium -quiet ./...
Expand Down
Loading

0 comments on commit d40ca73

Please sign in to comment.