Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit 812040d

Browse files
authored
Merge branch 'kubernetes-sigs:master' into master
2 parents ee3d153 + 7e7b773 commit 812040d

File tree

5 files changed

+131
-56
lines changed

5 files changed

+131
-56
lines changed

Diff for: .github/dependabot.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 2
2+
enable-beta-ecosystems: true
3+
updates:
4+
5+
- package-ecosystem: "gomod"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
groups: # batch updates together for fewer dependabot PRs
10+
golang-dependencies:
11+
patterns:
12+
- "github.com/golang*"
13+
k8s-dependencies:
14+
patterns:
15+
- "k8s.io*"
16+
- "sigs.k8s.io*"
17+
exclude-patterns:
18+
# controller-runtime has history of breaking API changes more often than other k8s projects
19+
- "sigs.k8s.io/controller-runtime"
20+
github-dependencies:
21+
patterns:
22+
- "github.com*"
23+
24+
- package-ecosystem: "docker"
25+
directory: "/"
26+
schedule:
27+
interval: "weekly"

Diff for: .prow.sh

-6
This file was deleted.

Diff for: Dockerfile

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
1+
#
2+
# BUILDER
3+
#
4+
FROM docker.io/library/golang:1.21.1 AS builder
5+
6+
WORKDIR /buildroot
7+
8+
# Cache deps before building and copying source, so that we don't need to re-download
9+
# as much and so that source changes don't invalidate our downloaded layer.
10+
COPY go.mod go.mod
11+
COPY go.sum go.sum
12+
RUN go mod download
13+
14+
COPY cmd/ cmd/
15+
COPY pkg/ pkg/
16+
17+
ENV CGO_ENABLED=0
18+
19+
RUN go build -o artifacts/controller-manager cmd/controller-manager/*.go
20+
21+
22+
#
23+
# FINAL IMAGE
24+
#
125
FROM gcr.io/distroless/static:latest
26+
227
LABEL maintainers="Kubernetes Authors"
328
LABEL description="COSI Controller"
429

5-
COPY ./bin/controller-manager controller-manager
30+
LABEL org.opencontainers.image.title="COSI Controller"
31+
LABEL org.opencontainers.image.description="Container Object Storage Interface (COSI) Controller"
32+
LABEL org.opencontainers.image.source="https://github.com/kubernetes-sigs/container-object-storage-interface-controller"
33+
LABEL org.opencontainers.image.licenses="APACHE-2.0"
34+
35+
COPY --from=builder /buildroot/artifacts/controller-manager .
636
ENTRYPOINT ["/controller-manager"]

Diff for: Makefile

+37-31
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
1-
# Copyright 2020 The Kubernetes Authors.
2-
#
3-
# Licensed under the Apache License, Version 2.0 (the "License");
4-
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
9-
# Unless required by applicable law or agreed to in writing, software
10-
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
# See the License for the specific language governing permissions and
13-
# limitations under the License.
14-
15-
all: reltools build
16-
.PHONY: reltools
17-
reltools: release-tools/build.make
18-
release-tools/build.make:
19-
$(eval CURDIR := $(shell pwd))
20-
$(eval TMP := $(shell mktemp -d))
21-
$(shell cd ${TMP} && git clone https://github.com/kubernetes-sigs/container-object-storage-interface-spec)
22-
$(shell cp -r ${TMP}/container-object-storage-interface-spec/release-tools ${CURDIR}/)
23-
$(shell rm -rf ${TMP})
24-
ln -s release-tools/travis.yml travis.yml
25-
26-
CMDS=controller-manager
27-
28-
include release-tools/build.make
29-
30-
IMAGE_NAME=gcr.io/k8s-staging-sig-storage/objectstorage-controller
31-
IMAGE_TAGS=$(GIT_TAG)
1+
.DEFAULT_GOAL := help
2+
SHELL = /usr/bin/env bash
3+
4+
# 'go env' vars aren't always available in make environments, so get defaults for needed ones
5+
GOARCH ?= $(shell go env GOARCH)
6+
7+
##
8+
## ==== ARGS ===== #
9+
10+
## Container build tool compatible with `docker` API
11+
DOCKER ?= docker
12+
13+
## Platform for 'build'
14+
PLATFORM ?= linux/$(GOARCH)
15+
16+
## Image tag for all builds
17+
IMAGE_TAG ?= cosi-controller:latest
18+
19+
##
20+
## === TARGETS === #
21+
22+
.PHONY: build
23+
## Build local image for development, defaulting linux/<hostarch>
24+
build:
25+
$(DOCKER) build --platform $(PLATFORM) --tag $(IMAGE_TAG) .
26+
27+
.PHONY: test
28+
## Test packages
29+
test:
30+
go vet ./...
31+
go test ./...
32+
33+
# print out lines beginning with double-comments, plus next line as basic help text
34+
.PHONY: help
35+
## Show this help text
36+
help:
37+
@sed -n -e "/^##/{N;s/^/\n/p;}" $(MAKEFILE_LIST)

Diff for: cloudbuild.yaml

+36-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
1-
# See https://cloud.google.com/cloud-build/docs/build-config
1+
# K8s infra build example: https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md
2+
# GCloud build docs: https://cloud.google.com/cloud-build/docs/build-config
3+
# Builds go to https://console.cloud.google.com/gcr/images/k8s-staging-sig-storage/GLOBAL
4+
# Build logs in https://testgrid.k8s.io/sig-storage-image-build
25
timeout: 3000s
3-
substitutions:
4-
_IMAGE_NAME: 'gcr.io/k8s-staging-sig-storage/objectstorage-controller'
5-
_GIT_TAG: '12345'
6-
_PULL_BASE_REF: 'master'
76
options:
8-
substitution_option: ALLOW_LOOSE
7+
substitution_option: 'ALLOW_LOOSE'
8+
machineType: 'E2_HIGHCPU_8'
9+
substitutions:
10+
# K8s provides custom substitutions _GIT_TAG and _PULL_BASE_REF:
11+
# https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md#custom-substitutions
12+
_GIT_TAG: '12345' # e.g., vYYYYMMDD-hash, vYYYYMMDD-tag, or vYYYYMMDD-tag-n-ghash
13+
_PULL_BASE_REF: 'master' # e.g., master or release-0.2 for a PR merge, or v0.2 for a tag
14+
# COSI substitutions:
15+
_IMAGE: objectstorage-controller
16+
_PLATFORMS: linux/amd64,linux/arm64 # add more platforms here if desired
917
steps:
10-
- name: "gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20221214-1b4dd4d69a"
11-
entrypoint: make
12-
args: ['build']
13-
env:
14-
- GIT_TAG=${_GIT_TAG}
15-
- PULL_BASE_REF=${_PULL_BASE_REF}
16-
- name: "gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20221214-1b4dd4d69a"
17-
entrypoint: make
18-
args: ['push']
19-
env:
20-
- GIT_TAG=${_GIT_TAG}
21-
- PULL_BASE_REF=${_PULL_BASE_REF}
18+
# based on k8s infra build example and modified to use docker buildx
19+
# buildx refs: https://github.com/docker/buildx/blob/master/docs/reference/buildx.md
20+
- id: set-up-multi-arch-builder-as-default
21+
name: gcr.io/cloud-builders/docker
22+
args: ["buildx", "create", "--use", "--name", "multi-arch", "--platform=${_PLATFORMS}"]
23+
- id: bootstrap-multi-arch-builder
24+
name: gcr.io/cloud-builders/docker
25+
args: ["buildx", "inspect", "--bootstrap"]
26+
- id: do-multi-arch-build
27+
name: gcr.io/cloud-builders/docker
28+
args:
29+
- buildx
30+
- build
31+
- --push # --load doesn't work with multi-platform builds, so just push from docker build
32+
- --platform=${_PLATFORMS}
33+
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:${_GIT_TAG}
34+
# using _PULL_BASE_REF as a tag will often just build and overwrite the same 'master' tag,
35+
# BUT! if the commit has a git tag, it will build that tag instead. this mechanism allows
36+
# creating the semver-tagged images that will be auto-promoted to release
37+
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:${_PULL_BASE_REF}
38+
- --tag=gcr.io/k8s-staging-sig-storage/${_IMAGE}:latest
39+
- .

0 commit comments

Comments
 (0)