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

Move operators dir #1616

Merged
merged 8 commits into from
Aug 23, 2019
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ vendor/
license.key

# generated from merging multiple files in the Makefile
operators/config/all-in-one.yaml
config/all-in-one.yaml

# ignore all generated docs HTML
docs/html/*

# ignore deployer files
operators/hack/deployer/deployer
operators/hack/deployer/config/run-config.yml

hack/deployer/deployer
hack/deployer/config/run-config.yml
File renamed without changes.
29 changes: 16 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@
Thank you for your interest in contributing to Elastic Cloud on Kubernetes!
The goal of this document is to provide a high-level overview on how you can get involved.

- [Report your bugs](#bug-reports)
- [Set up your development environment](#development-environment)
- [Contribute with your code](#contributing-code)
- [Format your code and manage imports](#format-your-code-and-import-management)
- [Test suites](#test-suites)
- [Logging](#logging)
- [License Headers](#license-headers)
- [Submit your changes](#submitting-changes)
- [Sign the CLA](#sign-the-cla)
- [Prepare a Pull Request](#prepare-a-pull-request)
- [Design documents](#design-documents)
- [How to Contribute to Elastic Cloud on Kubernetes](#how-to-contribute-to-elastic-cloud-on-kubernetes)
- [Report your bugs](#report-your-bugs)
- [Set up your development environment](#set-up-your-development-environment)
- [Contribute with your code](#contribute-with-your-code)
- [Format your code and manage imports](#format-your-code-and-manage-imports)
- [Scripts](#scripts)
- [Tests](#tests)
- [Test suites](#test-suites)
- [Logging](#logging)
- [License headers](#license-headers)
- [Submit your changes](#submit-your-changes)
- [Sign the CLA](#sign-the-cla)
- [Prepare a Pull Request](#prepare-a-pull-request)
- [Design documents](#design-documents)

## Report your bugs

If you find an issue, check first our [list of issues](https://github.com/elastic/cloud-on-k8s/issues). If your problem has not been reported yet, open a new issue, add a detailed description on how to reproduce the problem and complete it with any additional information that might help solving the issue.

## Set up your development environment

Check requirements and steps in this [guide](./operators/dev-setup.md).
Check requirements and steps in this [guide](dev-setup.md).

## Contribute with your code

Expand Down Expand Up @@ -99,4 +102,4 @@ Here are some good practices for a good pull request:

We keep track of architectural decisions through the [architectural decision records](https://adr.github.io/). All records must apply the [Markdown Architectural Decision Records](https://adr.github.io/madr/) format. We recommend to read [these documents](https://github.com/elastic/cloud-on-k8s/tree/master/docs/design) to understand the technical choices that we make.

Thank you for taking the time to contribute.
Thank you for taking the time to contribute.
6 changes: 3 additions & 3 deletions operators/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM golang:1.11 as builder

# Copy in the go src
WORKDIR /go/src/github.com/elastic/cloud-on-k8s/operators
WORKDIR /go/src/github.com/elastic/cloud-on-k8s
COPY pkg/ pkg/
COPY cmd/ cmd/
COPY vendor/ vendor/
Expand All @@ -14,7 +14,7 @@ ARG GO_TAGS
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
-o elastic-operator github.com/elastic/cloud-on-k8s/cmd

# Copy the controller-manager into a thin image
FROM centos:7
Expand All @@ -27,6 +27,6 @@ RUN set -x \
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/elastic-operator .
ENTRYPOINT ["./elastic-operator"]
CMD ["manager"]
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions operators/Makefile → Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ endif
OPERATOR_IMAGE ?= $(IMG):$(VERSION)-$(TAG)


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) \
-X github.com/elastic/cloud-on-k8s/operators/pkg/about.buildDate=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') \
-X github.com/elastic/cloud-on-k8s/operators/pkg/about.buildSnapshot=$(SNAPSHOT)
GO_LDFLAGS := -X github.com/elastic/cloud-on-k8s/pkg/about.version=$(VERSION) \
-X github.com/elastic/cloud-on-k8s/pkg/about.buildHash=$(TAG) \
-X github.com/elastic/cloud-on-k8s/pkg/about.buildDate=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') \
-X github.com/elastic/cloud-on-k8s/pkg/about.buildSnapshot=$(SNAPSHOT)

# Setting for CI, if set to true will prevent building and using local Docker image
SKIP_DOCKER_COMMAND ?= false
Expand Down Expand Up @@ -93,7 +93,7 @@ generate:
$(MAKE) --no-print-directory generate-all-in-one

elastic-operator: generate
go build -ldflags "$(GO_LDFLAGS)" -tags='$(GO_TAGS)' -o bin/elastic-operator github.com/elastic/cloud-on-k8s/operators/cmd
go build -ldflags "$(GO_LDFLAGS)" -tags='$(GO_TAGS)' -o bin/elastic-operator github.com/elastic/cloud-on-k8s/cmd

fmt:
goimports -w pkg cmd
Expand Down
3 changes: 3 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: "1"
domain: k8s.elastic.co
repo: github.com/elastic/cloud-on-k8s
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ Supported versions:
* Elasticsearch: 6.8+, 7.1+

Check the [Quickstart](https://www.elastic.co/guide/en/cloud-on-k8s/current/index.html) if you want to deploy you first cluster with ECK.

If you want to contribute to the project, check our [contributing guide](CONTRIBUTING.md) and see [how to setup a local development environment](dev-setup.md).
File renamed without changes.
10 changes: 5 additions & 5 deletions build/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ RUN apt-get update && apt-get --no-install-recommends -y install \
RUN curl -sSL https://aka.ms/InstallAzureCLIDeb | bash

# Add Go dependencies to Docker image
WORKDIR /go/src/github.com/elastic/cloud-on-k8s/operators
COPY operators/Gopkg.lock .
COPY operators/Gopkg.toml .
WORKDIR /go/src/github.com/elastic/cloud-on-k8s
COPY Gopkg.lock .
COPY Gopkg.toml .
RUN dep ensure --vendor-only -v

# Cleanup
RUN rm /go/src/github.com/elastic/cloud-on-k8s/operators/Gopkg.lock && \
rm /go/src/github.com/elastic/cloud-on-k8s/operators/Gopkg.toml
RUN rm /go/src/github.com/elastic/cloud-on-k8s/Gopkg.lock && \
rm /go/src/github.com/elastic/cloud-on-k8s/Gopkg.toml
WORKDIR /
12 changes: 6 additions & 6 deletions build/ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ROOT_DIR = $(CURDIR)/../..
GO_MOUNT_PATH ?= /go/src/github.com/elastic/cloud-on-k8s

CI_IMAGE ?= docker.elastic.co/eck/eck-ci:$(shell md5sum $(ROOT_DIR)/operators/Gopkg.lock $(ROOT_DIR)/build/ci/Dockerfile | awk '{print $$1}' | md5sum | awk '{print $$1}')
CI_IMAGE ?= docker.elastic.co/eck/eck-ci:$(shell md5sum $(ROOT_DIR)/Gopkg.lock $(ROOT_DIR)/build/ci/Dockerfile | awk '{print $$1}' | md5sum | awk '{print $$1}')

VAULT_GKE_CREDS_SECRET ?= secret/cloud-team/cloud-ci/ci-gcp-k8s-operator
GKE_CREDS_FILE ?= credentials.json
Expand Down Expand Up @@ -82,7 +82,7 @@ ci-pr: check-license-header
--net=host \
$(CI_IMAGE) \
bash -c \
"make -C operators ci"
"make ci"

## -- Release job

Expand All @@ -99,7 +99,7 @@ ci-release: vault-public-key vault-docker-creds
-e "VERSION=$(VERSION)" \
-e "SNAPSHOT=$(SNAPSHOT)" \
$(CI_IMAGE) \
bash -c "make -C operators ci-release"
bash -c "make ci-release"

# Will be uploaded to https://download.elastic.co/downloads/eck/$TAG_NAME/all-in-one.yaml
yaml-upload: vault-aws-creds
Expand All @@ -109,7 +109,7 @@ yaml-upload: vault-aws-creds
-e "AWS_ACCESS_KEY_ID=$(shell cat $(VAULT_AWS_ACCESS_KEY_FILE))" \
-e "AWS_SECRET_ACCESS_KEY=$(shell cat $(VAULT_AWS_SECRET_KEY_FILE))" \
$(CI_IMAGE) \
bash -c "aws s3 cp $(GO_MOUNT_PATH)/operators/config/all-in-one.yaml \
bash -c "aws s3 cp $(GO_MOUNT_PATH)/config/all-in-one.yaml \
s3://download.elasticsearch.org/downloads/eck/$(TAG_NAME)/all-in-one.yaml"

## -- End-to-end tests job
Expand All @@ -128,7 +128,7 @@ ci-e2e:
-e "OPERATOR_IMAGE=$(OPERATOR_IMAGE)" \
-e "STACK_VERSION=$(STACK_VERSION)" \
$(CI_IMAGE) \
bash -c "make -C operators ci-e2e"
bash -c "make ci-e2e"

ci-run-deployer:
@ docker run --rm -t \
Expand All @@ -137,7 +137,7 @@ ci-run-deployer:
-w $(GO_MOUNT_PATH) \
-e "GCLOUD_PROJECT=$(GCLOUD_PROJECT)" \
$(CI_IMAGE) \
bash -c "make -C operators run-deployer"
bash -c "make run-deployer"

# Check if Docker image exists by trying to pull it. If there is no image, then build and push it.
ci-build-image: vault-docker-creds
Expand Down
2 changes: 1 addition & 1 deletion build/ci/e2e/GKE_k8s_versions.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pipeline {

void createRunConfig(clusterVersion, clusterName) {
sh """
cat >operators/run-config.yml <<EOF
cat >run-config.yml <<EOF
id: gke-ci
overrides:
operation: create
Expand Down
4 changes: 2 additions & 2 deletions build/ci/e2e/Jenkinsfile-aks
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline {
stage("Run E2E tests") {
steps {
sh """
cat >operators/run-config.yml <<EOF
cat >run-config.yml <<EOF
id: aks-ci
overrides:
kubernetesVersion: "$CLUSTER_VERSION"
Expand All @@ -47,7 +47,7 @@ EOF
cleanup {
script {
sh """
cat >operators/run-config.yml <<EOF
cat >run-config.yml <<EOF
id: aks-ci
overrides:
operation: delete
Expand Down
2 changes: 1 addition & 1 deletion build/ci/e2e/custom_operator_image.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pipeline {
stage("Run E2E tests") {
steps {
sh """
cat >operators/run-config.yml <<EOF
cat >run-config.yml <<EOF
id: gke-ci
overrides:
kubernetesVersion: "$CLUSTER_VERSION"
Expand Down
2 changes: 1 addition & 1 deletion build/ci/e2e/stack_versions.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pipeline {

def createRunConfig(clusterName) {
sh """
cat >operators/run-config.yml <<EOF
cat >run-config.yml <<EOF
id: gke-ci
overrides:
operation: create
Expand Down
2 changes: 1 addition & 1 deletion build/ci/nightly/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pipeline {
stage('Build and push Docker image') {
steps {
sh """
export VERSION=\$(cat $WORKSPACE/operators/VERSION)-\$(date +%F)-\$(git rev-parse --short --verify HEAD)
export VERSION=\$(cat $WORKSPACE/VERSION)-\$(date +%F)-\$(git rev-parse --short --verify HEAD)
export OPERATOR_IMAGE=${REGISTRY}/${REPOSITORY}/${IMG_NAME}:\$VERSION
export LATEST_RELEASED_IMG=docker.elastic.co/${REPOSITORY}/${IMG_NAME}:\$VERSION
echo \$LATEST_RELEASED_IMG > eck_image.txt
Expand Down
2 changes: 1 addition & 1 deletion build/ci/pr/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pipeline {
}
steps {
sh """
cat >operators/run-config.yml <<EOF
cat >run-config.yml <<EOF
id: gke-ci
overrides:
kubernetesVersion: "$CLUSTER_VERSION"
Expand Down
4 changes: 2 additions & 2 deletions operators/cmd/main.go → cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package main

import (
"github.com/elastic/cloud-on-k8s/operators/cmd/manager"
"github.com/elastic/cloud-on-k8s/operators/pkg/dev"
"github.com/elastic/cloud-on-k8s/cmd/manager"
"github.com/elastic/cloud-on-k8s/pkg/dev"
"github.com/spf13/cobra"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log"
Expand Down
18 changes: 9 additions & 9 deletions operators/cmd/manager/main.go → cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (
"strings"
"time"

"github.com/elastic/cloud-on-k8s/operators/pkg/about"
"github.com/elastic/cloud-on-k8s/operators/pkg/apis"
"github.com/elastic/cloud-on-k8s/operators/pkg/controller"
"github.com/elastic/cloud-on-k8s/operators/pkg/controller/common/certificates"
"github.com/elastic/cloud-on-k8s/operators/pkg/controller/common/operator"
"github.com/elastic/cloud-on-k8s/operators/pkg/dev"
"github.com/elastic/cloud-on-k8s/operators/pkg/dev/portforward"
"github.com/elastic/cloud-on-k8s/operators/pkg/utils/net"
"github.com/elastic/cloud-on-k8s/operators/pkg/webhook"
"github.com/elastic/cloud-on-k8s/pkg/about"
"github.com/elastic/cloud-on-k8s/pkg/apis"
"github.com/elastic/cloud-on-k8s/pkg/controller"
"github.com/elastic/cloud-on-k8s/pkg/controller/common/certificates"
"github.com/elastic/cloud-on-k8s/pkg/controller/common/operator"
"github.com/elastic/cloud-on-k8s/pkg/dev"
"github.com/elastic/cloud-on-k8s/pkg/dev/portforward"
"github.com/elastic/cloud-on-k8s/pkg/utils/net"
"github.com/elastic/cloud-on-k8s/pkg/webhook"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"k8s.io/client-go/kubernetes"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion operators/dev-setup.md → dev-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Before you start, install the following tools and packages:

```bash
go get -u github.com/elastic/cloud-on-k8s
cd ${GOPATH:-$HOME/go}/src/github.com/elastic/cloud-on-k8s/operators
cd ${GOPATH:-$HOME/go}/src/github.com/elastic/cloud-on-k8s
```

### Check prerequisites
Expand Down
6 changes: 3 additions & 3 deletions docs/k8s-quickstart.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ To aim for the best performance, the operator supports persistent volumes local
[id="{p}-check-samples"]
=== Check out the samples

You can find a set of sample resources link:https://github.com/elastic/cloud-on-k8s/tree/master/operators/config/samples[in the project repository].
To customize the Elasticsearch resource, check the link:https://github.com/elastic/cloud-on-k8s/blob/master/operators/config/samples/elasticsearch/elasticsearch.yaml[Elasticsearch sample].
You can find a set of sample resources link:https://github.com/elastic/cloud-on-k8s/tree/master/config/samples[in the project repository].
To customize the Elasticsearch resource, check the link:https://github.com/elastic/cloud-on-k8s/blob/master/config/samples/elasticsearch/elasticsearch.yaml[Elasticsearch sample].

For a full description of each `CustomResourceDefinition`, go to link:https://github.com/elastic/cloud-on-k8s/tree/master/operators/config/crds[the project repository].
For a full description of each `CustomResourceDefinition`, go to link:https://github.com/elastic/cloud-on-k8s/tree/master/config/crds[the project repository].
You can also retrieve it from the cluster. For example, describe the Elasticsearch CRD specification with:

[source,sh]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Default values for settings are kept in config/plans.yml file. More settings and
While in:
```
$ pwd
/go/src/github.com/elastic/cloud-on-k8s/operators
/go/src/github.com/elastic/cloud-on-k8s
```

Run once with your GCLOUD_PROJECT:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package cmd

import (
"github.com/elastic/cloud-on-k8s/operators/hack/deployer/runner"
"github.com/elastic/cloud-on-k8s/hack/deployer/runner"
"github.com/spf13/cobra"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package cmd
import (
"fmt"

"github.com/elastic/cloud-on-k8s/operators/hack/deployer/runner"
"github.com/elastic/cloud-on-k8s/hack/deployer/runner"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion operators/hack/deployer/main.go → hack/deployer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package main

import (
"github.com/elastic/cloud-on-k8s/operators/hack/deployer/cmd"
"github.com/elastic/cloud-on-k8s/hack/deployer/cmd"
)

func main() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions operators/PROJECT

This file was deleted.

7 changes: 0 additions & 7 deletions operators/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package apis

import (
"github.com/elastic/cloud-on-k8s/operators/pkg/apis/apm/v1alpha1"
"github.com/elastic/cloud-on-k8s/pkg/apis/apm/v1alpha1"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package apis

import (
"github.com/elastic/cloud-on-k8s/operators/pkg/apis/associations/v1alpha1"
"github.com/elastic/cloud-on-k8s/pkg/apis/associations/v1alpha1"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package apis

import (
"github.com/elastic/cloud-on-k8s/operators/pkg/apis/common/v1alpha1"
"github.com/elastic/cloud-on-k8s/pkg/apis/common/v1alpha1"
)

func init() {
Expand Down
Loading