Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions build.assets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ TEST_KUBE ?=

OS ?= linux
ARCH ?= amd64
BUILDBOX_VERSION ?= teleport10
GOLANG_VERSION ?= go1.18.6
RUST_VERSION ?= 1.63.0 # don't bump this without checking GLIBC compatibility
NODE_VERSION ?= 16.13.2
Expand All @@ -42,13 +41,8 @@ PROTOC_VER ?= 3.13.0
# Keep in sync with api/proto/buf.yaml (and buf.lock).
GOGO_PROTO_TAG ?= v1.3.2

BUILDBOX=public.ecr.aws/gravitational/teleport-buildbox:$(BUILDBOX_VERSION)
BUILDBOX_FIPS=public.ecr.aws/gravitational/teleport-buildbox-fips:$(BUILDBOX_VERSION)
BUILDBOX_CENTOS7=public.ecr.aws/gravitational/teleport-buildbox-centos7:$(BUILDBOX_VERSION)
BUILDBOX_CENTOS7_FIPS=public.ecr.aws/gravitational/teleport-buildbox-centos7-fips:$(BUILDBOX_VERSION)
BUILDBOX_ARM=public.ecr.aws/gravitational/teleport-buildbox-arm:$(BUILDBOX_VERSION)
BUILDBOX_ARM_FIPS=public.ecr.aws/gravitational/teleport-buildbox-arm-fips:$(BUILDBOX_VERSION)
BUILDBOX_TELETERM=public.ecr.aws/gravitational/teleport-buildbox-teleterm:$(BUILDBOX_VERSION)
# BUILDBOX_VERSION, BUILDBOX and BUILDBOX_variant variables are included
include images.mk

# These variables are used to dynamically change the name of the buildbox Docker image used by the 'release'
# target. The other solution was to remove the 'buildbox' dependency from the 'release' target, but this would
Expand Down
11 changes: 11 additions & 0 deletions build.assets/images.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Those variables are extracted from build.assets/Makefile so they can be imported
# by other Makefiles
BUILDBOX_VERSION ?= teleport10

BUILDBOX=public.ecr.aws/gravitational/teleport-buildbox:$(BUILDBOX_VERSION)
BUILDBOX_FIPS=public.ecr.aws/gravitational/teleport-buildbox-fips:$(BUILDBOX_VERSION)
BUILDBOX_CENTOS7=public.ecr.aws/gravitational/teleport-buildbox-centos7:$(BUILDBOX_VERSION)
BUILDBOX_CENTOS7_FIPS=public.ecr.aws/gravitational/teleport-buildbox-centos7-fips:$(BUILDBOX_VERSION)
BUILDBOX_ARM=public.ecr.aws/gravitational/teleport-buildbox-arm:$(BUILDBOX_VERSION)
BUILDBOX_ARM_FIPS=public.ecr.aws/gravitational/teleport-buildbox-arm-fips:$(BUILDBOX_VERSION)
BUILDBOX_TELETERM=public.ecr.aws/gravitational/teleport-buildbox-teleterm:$(BUILDBOX_VERSION)
5 changes: 2 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# The base image (buildbox:latest) is built by running `make -C build.assets`
# from the base repo directory $GOPATH/gravitational.com/teleport
FROM public.ecr.aws/gravitational/teleport-buildbox:teleport10
ARG BUILDBOX
FROM $BUILDBOX

# DEBUG=1 is needed for the Web UI to be loaded from static assets instead
# of the binary
Expand Down
5 changes: 4 additions & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PRO_LICENSE ?= ../e/fixtures/license-pro.pem
# whether to look for enterprise or pro license
MODE ?= enterprise

# include BUILDBOX_VERSION, BUILDBOX and BUILDBOX_variant variables
include ../build.assets/images.mk

#
# Default target starts two Teleport clusters
#
Expand Down Expand Up @@ -82,7 +85,7 @@ check-license:

.PHONY: build
build:
docker build -t teleport:latest .
docker build --build-arg BUILDBOX=$(BUILDBOX) -t teleport:latest .

.PHONY: clean
clean:
Expand Down
11 changes: 6 additions & 5 deletions operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Build the manager binary
FROM golang:1.18 as builder
ARG BUILDBOX
FROM $BUILDBOX as builder

WORKDIR /go/src/github.com/gravitational/teleport

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
Expand All @@ -22,10 +23,10 @@ COPY operator/main.go operator/main.go
COPY operator/namespace.go operator/namespace.go

# Build
RUN GOOS=linux GOARCH=amd64 go build -a -o teleport-operator github.com/gravitational/teleport/operator
RUN GOOS=linux GOARCH=amd64 go build -a -o /go/bin/teleport-operator github.com/gravitational/teleport/operator

FROM gcr.io/distroless/cc
WORKDIR /
COPY --from=builder /workspace/teleport-operator .
COPY --from=builder /go/bin/teleport-operator .

ENTRYPOINT ["/teleport-operator"]
47 changes: 5 additions & 42 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,9 @@
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.0.1

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif

# DEFAULT_CHANNEL defines the default channel used in the bundle.
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
# This variable is used to construct full image tags for bundle and catalog images.
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# teleport.dev/operator-bundle:$VERSION and teleport.dev/operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= teleport.dev/operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)

# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)

# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
# You can enable this value if you would like to use SHA Based Digests
# To enable set flag to true
USE_IMAGE_DIGESTS ?= false
ifeq ($(USE_IMAGE_DIGESTS), true)
BUNDLE_GEN_FLAGS += --use-image-digests
endif

# Image URL to use all building/pushing image targets
IMG ?= teleport-operator:latest

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.23

Expand All @@ -57,6 +17,9 @@ ENVTEST_K8S_VERSION = 1.23
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

# include BUILDBOX_VERSION, BUILDBOX and BUILDBOX_variant variables
include ../build.assets/images.mk

.PHONY: all
all: build

Expand Down Expand Up @@ -140,7 +103,7 @@ run: manifests generate fmt vet ## Run a controller from your host.

.PHONY: docker-build
docker-build: ## Build docker image with the manager.
docker build -t ${IMG} .. -f ./Dockerfile
docker build --build-arg BUILDBOX=$(BUILDBOX) -t ${IMG} .. -f ./Dockerfile

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
Expand Down