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
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
open-pull-requests-limit: 10
reviewers:
- "onmetal/onmetal-api-maintainers"
- "ironcore-dev/core"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
open-pull-requests-limit: 10
reviewers:
- "onmetal/onmetal-api-maintainers"
- "ironcore-dev/core"
4 changes: 2 additions & 2 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name-template: 'v$RESOLVED_VERSION 🌈'
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
Expand Down Expand Up @@ -48,4 +48,4 @@ autolabeler:
- '/JIRA-[0-9]{1,4}/'
template: |
## Changes
$CHANGES
$CHANGES
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.1
version: v1.55.2
10 changes: 8 additions & 2 deletions .github/workflows/size-label.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
name: Size Label

on:
pull_request_target:
types: [ assigned, opened, synchronize, reopened ]
pull_request:
types:
- opened
- edited
- synchronize

jobs:
size-label:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: size-label
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version-file: 'go.mod'
- run: make test check-license
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ linters:
- goimports
- importas
- unused
- ginkgolinter

severity:
default-severity: error
Expand Down
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# onmetal-api maintainers
* @onmetal/onmetal-api-maintainers
# ironcore-dev core maintainers
* @ironcore-dev/core
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Please refer to the [Gardener on Metal code of conduct](https://onmetal.github.io/documentation/contribute/overview/#code-of-conduct).
Please refer to the [IronCore code of conduct](https://ironcore-dev.github.io/documentation/contribute/overview/#code-of-conduct).
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Please refer to the [Gardener on Metal contributor guide](https://onmetal.github.io/documentation/contribute/overview/).
Please refer to the [IronCore contributor guide](https://ironcore-dev.github.io/documentation/contribute/overview/).
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ help: ## Display this help.

.PHONY: add-license
add-license: addlicense ## Add license headers to all go files.
find . -name '*.go' -exec $(ADDLICENSE) -c 'OnMetal authors' {} +
find . -name '*.go' -exec $(ADDLICENSE) -c 'IronCore authors' {} +

.PHONY: fmt
fmt: goimports ## Run goimports against code.
Expand All @@ -37,12 +37,12 @@ vet: ## Run go vet against code.
go vet ./...

.PHONY: lint
lint: ## Lints the code-base using golangci-lint.
golangci-lint run ./...
lint: golangci-lint ## Run golangci-lint on the code.
$(GOLANGCILINT) run ./...

.PHONY: check-license
check-license: addlicense ## Check that every file has a license header present.
find . -name '*.go' -exec $(ADDLICENSE) -check -c 'OnMetal authors' {} +
find . -name '*.go' -exec $(ADDLICENSE) -check -c 'IronCore authors' {} +

.PHONY: generate
generate: mockgen ## Generate code (mocks etc.).
Expand All @@ -69,11 +69,13 @@ $(LOCALBIN):
ADDLICENSE ?= $(LOCALBIN)/addlicense
GOIMPORTS ?= $(LOCALBIN)/goimports
MOCKGEN ?= $(LOCALBIN)/mockgen
GOLANGCILINT ?= $(LOCALBIN)/golangci-lint

## Tool Versions
ADDLICENSE_VERSION ?= v1.1.1
GOIMPORTS_VERSION ?= v0.13.0
GOIMPORTS_VERSION ?= v0.14.0
MOCKGEN_VERSION ?= v0.3.0
GOLANGCILINT_VERSION ?= v1.55.2

.PHONY: addlicense
addlicense: $(ADDLICENSE) ## Download addlicense locally if necessary.
Expand All @@ -89,3 +91,8 @@ $(GOIMPORTS): $(LOCALBIN)
mockgen: $(MOCKGEN) ## Download mockgen locally if necessary.
$(MOCKGEN): $(LOCALBIN)
test -s $(LOCALBIN)/mockgen || GOBIN=$(LOCALBIN) go install go.uber.org/mock/mockgen@$(MOCKGEN_VERSION)

.PHONY: goimports
golangci-lint: $(GOLANGCILINT) ## Download golangci-lint locally if necessary.
$(GOLANGCILINT): $(LOCALBIN)
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCILINT_VERSION)
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# controller-utils

[![Go Report Card](https://goreportcard.com/badge/github.com/onmetal/controller-utils)](https://goreportcard.com/report/github.com/onmetal/controller-utils)
[![Go Reference](https://pkg.go.dev/badge/github.com/onmetal/controller-utils.svg)](https://pkg.go.dev/github.com/onmetal/controller-utils)
[![Test](https://github.com/onmetal/controller-utils/actions/workflows/test.yml/badge.svg)](https://github.com/onmetal/controller-utils/actions/workflows/test.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/ironcore-dev/controller-utils)](https://goreportcard.com/report/github.com/ironcore-dev/controller-utils)
[![Go Reference](https://pkg.go.dev/badge/github.com/ironcore-dev/controller-utils.svg)](https://pkg.go.dev/github.com/ironcore-dev/controller-utils)
[![Test](https://github.com/ironcore-dev/controller-utils/actions/workflows/test.yml/badge.svg)](https://github.com/ironcore-dev/controller-utils/actions/workflows/test.yml)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
[![GitHub License](https://img.shields.io/static/v1?label=License&message=Apache-2.0&color=blue&style=flat-square)](LICENSE)

## Overview

controller-utils contains common functionality used across multiple controllers in the onmetal organization.
controller-utils contains common functionality used across multiple controllers in the ironcore-dev organization.

## Installation, Usage and Development

To use the library in your project, just run

```shell
go get github.com/onmetal/controller-utils
go get github.com/ironcore-dev/controller-utils
```

## License

[Apache-2.0](LICENSE)

2 changes: 1 addition & 1 deletion buildutils/alias.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion buildutils/buildutils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion buildutils/buildutils_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions buildutils/buildutils_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
package buildutils_test

import (
. "github.com/onmetal/controller-utils/buildutils"
. "github.com/ironcore-dev/controller-utils/buildutils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
Expand Down
6 changes: 3 additions & 3 deletions clientutils/clientutils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,8 +21,8 @@ import (
"fmt"
"reflect"

"github.com/onmetal/controller-utils/metautils"
"github.com/onmetal/controller-utils/unstructuredutils"
"github.com/ironcore-dev/controller-utils/metautils"
"github.com/ironcore-dev/controller-utils/unstructuredutils"
"k8s.io/apimachinery/pkg/api/equality"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
Expand Down
2 changes: 1 addition & 1 deletion clientutils/clientutils_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
14 changes: 7 additions & 7 deletions clientutils/clientutils_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -21,10 +21,10 @@ import (
"reflect"
"strings"

. "github.com/onmetal/controller-utils/clientutils"
mockclient "github.com/onmetal/controller-utils/mock/controller-runtime/client"
mockclientutils "github.com/onmetal/controller-utils/mock/controller-utils/clientutils"
"github.com/onmetal/controller-utils/testdata"
. "github.com/ironcore-dev/controller-utils/clientutils"
mockclient "github.com/ironcore-dev/controller-utils/mock/controller-runtime/client"
mockclientutils "github.com/ironcore-dev/controller-utils/mock/controller-utils/clientutils"
"github.com/ironcore-dev/controller-utils/testdata"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/mock"
Expand Down Expand Up @@ -132,13 +132,13 @@ var _ = Describe("Clientutils", func() {
Describe("IgnoreAlreadyExists", func() {
It("should ignore already exists errors", func() {
alreadyExistsErr := IgnoreAlreadyExists(apierrors.NewAlreadyExists(cmGR, ""))
Expect(IgnoreAlreadyExists(alreadyExistsErr)).To(BeNil())
Expect(IgnoreAlreadyExists(alreadyExistsErr)).To(Succeed())
})

It("should not ignore other errors or nil", func() {
err := fmt.Errorf("some error")
Expect(IgnoreAlreadyExists(err)).To(BeIdenticalTo(err))
Expect(IgnoreAlreadyExists(nil)).To(BeNil())
Expect(IgnoreAlreadyExists(nil)).To(Succeed())
})
})

Expand Down
2 changes: 1 addition & 1 deletion clientutils/fieldindexer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions clientutils/fieldindexer_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@ package clientutils
import (
"context"

mockclient "github.com/onmetal/controller-utils/mock/controller-runtime/client"
mockclient "github.com/ironcore-dev/controller-utils/mock/controller-runtime/client"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"
Expand Down
2 changes: 1 addition & 1 deletion clientutils/objectkey.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions clientutils/objectkey_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
package clientutils_test

import (
. "github.com/onmetal/controller-utils/clientutils"
. "github.com/ironcore-dev/controller-utils/clientutils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
2 changes: 1 addition & 1 deletion clientutils/objectref.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion clientutils/objectref_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmdutils/switches/switches.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmdutils/switches/switches_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion cmdutils/switches/switches_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion conditionutils/alias.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions conditionutils/alias_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

. "github.com/onmetal/controller-utils/conditionutils"
. "github.com/ironcore-dev/controller-utils/conditionutils"
)

var _ = Describe("Alias", func() {
Expand Down
2 changes: 1 addition & 1 deletion conditionutils/conditionutils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion conditionutils/conditionutils_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions conditionutils/conditionutils_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 OnMetal authors
// Copyright 2021 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@ package conditionutils_test
import (
"time"

. "github.com/onmetal/controller-utils/conditionutils"
. "github.com/ironcore-dev/controller-utils/conditionutils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
Expand Down
2 changes: 1 addition & 1 deletion configutils/configutils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion configutils/configutils_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 OnMetal authors
// Copyright 2022 IronCore authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Loading