Skip to content

Commit

Permalink
Apply improvements from code review
Browse files Browse the repository at this point in the history
On-behalf-of: @SAP [email protected]
Signed-off-by: Marvin Beckers <[email protected]>
  • Loading branch information
embik committed Nov 21, 2024
1 parent ebc3255 commit a3487f8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
16 changes: 16 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Development

## kubebuilder

For historic documentation, this project has been generated with [kubebuilder](https://book.kubebuilder.io/) with the following version information:

```sh
$ kubebuilder version
Version: main.version{KubeBuilderVersion:"4.3.1", KubernetesVendor:"unknown", GitCommit:"a9ee3909f7686902879bd666b92deec4718d92c9", BuildDate:"2024-11-09T09:58:43Z", GoOs:"darwin", GoArch:"arm64"}
```

The project has been initialised with:

```sh
$ kubebuilder init --domain operator.kcp.io --owner "The KCP Authors" --project-name kcp-operator
```
23 changes: 12 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# OPENSHIFT_GIMPORTS_VER defines which version of openshift-goimports to use
# for checking import statements.
OPENSHIFT_GOIMPORTS_VER := c72f1dc2e3aacfa00aece3391d938c9bc734e791
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.31.0
## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.16.1
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.59.1

# Image URL to use all building/pushing image targets
IMG ?= ghcr.io/kcp-dev/kcp-operator

GO_INSTALL = ./hack/go-install.sh
TOOLS_DIR=hack/tools
Expand All @@ -21,9 +30,6 @@ endif
# tools. (i.e. podman)
CONTAINER_TOOL ?= docker

# OPENSHIFT_GIMPORTS_VER defines which version of openshift-goimports to use
# for checking import statements.
OPENSHIFT_GOIMPORTS_VER := c72f1dc2e3aacfa00aece3391d938c9bc734e791
OPENSHIFT_GOIMPORTS_BIN := openshift-goimports
OPENSHIFT_GOIMPORTS := $(TOOLS_DIR)/$(OPENSHIFT_GOIMPORTS_BIN)-$(OPENSHIFT_GOIMPORTS_VER)
export OPENSHIFT_GOIMPORTS # so hack scripts can use it
Expand Down Expand Up @@ -97,7 +103,7 @@ $(OPENSHIFT_GOIMPORTS):

.PHONY: imports
imports: $(OPENSHIFT_GOIMPORTS)
$(OPENSHIFT_GOIMPORTS) -m github.com/kcp-dev/kcp
$(OPENSHIFT_GOIMPORTS) -m github.com/kcp-dev/kcp-operator

.PHONY: verify
verify: manifests generate fmt vet modules imports ## Run all codegen and formatting targets and check if files have changed
Expand Down Expand Up @@ -167,11 +173,6 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.16.1
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.59.1

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand Down
12 changes: 6 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ func init() {
}

func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var secureMetrics bool
var enableHTTP2 bool
var tlsOpts []func(*tls.Config)
var (
metricsAddr, probeAddr string
enableLeaderElection, secureMetrics, enableHTTP2 bool
tlsOpts []func(*tls.Config)
)

flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+
"Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
Expand Down

0 comments on commit a3487f8

Please sign in to comment.