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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ jobs:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up Go 1.25
uses: actions/setup-go@v5
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: '1.25'
id: go

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
with:
cache-image: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0

- name: Run checks
run: |
Expand All @@ -47,17 +47,17 @@ jobs:
matrix:
k8s: [v1.35.0]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up Go 1.25
uses: actions/setup-go@v5
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: '1.25'
id: go

- name: Create Kubernetes ${{ matrix.k8s }} cluster
id: kind
uses: engineerd/setup-kind@v0.5.0
uses: engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 # v0.5.0
with:
version: v0.31.0
image: kindest/node:${{ matrix.k8s }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Prepare git
env:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Print version info
id: semver
Expand All @@ -25,15 +25,15 @@ jobs:

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
with:
cache-image: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0

- name: Log in to the GitHub Container registry
uses: docker/login-action@v2
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -46,7 +46,7 @@ jobs:
make release COMPRESS=yes

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Expand Down
21 changes: 8 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,22 @@ version: "2"
linters:
default: standard
enable:
- bodyclose
- prealloc
- unparam
exclusions:
paths:
- generated.*\.go
- client
- vendor

formatters:
enable:
- gofmt
- gofumpt
- goimports
settings:
gofmt:
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'

issues:
max-same-issues: 100

exclude-files:
- generated.*\\.go

exclude-dirs:
- client
- vendor

run:
timeout: 10m
3 changes: 2 additions & 1 deletion apis/kubebind/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ func Resource(resource string) schema.GroupResource {

// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
scheme.AddKnownTypes(
SchemeGroupVersion,
&APIServiceBinding{},
&APIServiceBindingList{},
&APIServiceExport{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,24 @@ func (r *reconciler) reconcile(ctx context.Context, clusterBinding *v1alpha1.Clu

func (r *reconciler) ensureClusterBindingConditions(clusterBinding *v1alpha1.ClusterBinding) {
if clusterBinding.Status.LastHeartbeatTime.IsZero() {
conditions.MarkFalse(clusterBinding,
conditions.MarkFalse(
clusterBinding,
v1alpha1.ClusterBindingConditionHealthy,
"FirstHeartbeatPending",
conditionsapi.ConditionSeverityInfo,
"Waiting for first heartbeat",
)
} else if clusterBinding.Status.HeartbeatInterval.Duration == 0 {
conditions.MarkFalse(clusterBinding,
conditions.MarkFalse(
clusterBinding,
v1alpha1.ClusterBindingConditionHealthy,
"HeartbeatIntervalMissing",
conditionsapi.ConditionSeverityInfo,
"Waiting for consumer cluster reporting its heartbeat interval",
)
} else if ago := time.Since(clusterBinding.Status.LastHeartbeatTime.Time); ago > clusterBinding.Status.HeartbeatInterval.Duration*2 {
conditions.MarkFalse(clusterBinding,
conditions.MarkFalse(
clusterBinding,
v1alpha1.ClusterBindingConditionHealthy,
"HeartbeatTimeout",
conditionsapi.ConditionSeverityError,
Expand All @@ -100,14 +103,16 @@ func (r *reconciler) ensureClusterBindingConditions(clusterBinding *v1alpha1.Clu
clusterBinding.Status.LastHeartbeatTime.Time, // do not put "ago" here. It will hotloop.
)
} else if ago < time.Second*10 {
conditions.MarkFalse(clusterBinding,
conditions.MarkFalse(
clusterBinding,
v1alpha1.ClusterBindingConditionHealthy,
"HeartbeatTimeDrift",
conditionsapi.ConditionSeverityWarning,
"Clocks of consumer cluster and service account cluster seem to be off by more than 10s",
)
} else {
conditions.MarkTrue(clusterBinding,
conditions.MarkTrue(
clusterBinding,
v1alpha1.ClusterBindingConditionHealthy,
)
}
Expand Down
3 changes: 2 additions & 1 deletion contrib/example-backend/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ func (s *Server) OptionallyStartInformers(ctx context.Context) {
kubeBindSynced := s.Config.BindInformers.WaitForCacheSync(ctx.Done())
apiextensionsSynced := s.Config.ApiextensionsInformers.WaitForCacheSync(ctx.Done())

logger.Info("local informers are synced",
logger.Info(
"local informers are synced",
"kubeSynced", fmt.Sprintf("%v", kubeSynced),
"kubeBindSynced", fmt.Sprintf("%v", kubeBindSynced),
"apiextensionsSynced", fmt.Sprintf("%v", apiextensionsSynced),
Expand Down
3 changes: 2 additions & 1 deletion hack/deploy/konnector/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import (
var raw embed.FS

func Bootstrap(ctx context.Context, discoveryClient discovery.DiscoveryInterface, dynamicClient dynamic.Interface, image string) error {
return bootstrap.Bootstrap(ctx, discoveryClient, dynamicClient, sets.New[string](), raw,
return bootstrap.Bootstrap(
ctx, discoveryClient, dynamicClient, sets.New[string](), raw,
bootstrap.ReplaceOption("IMAGE", image),
)
}
2 changes: 1 addition & 1 deletion pkg/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func Bootstrap(ctx context.Context, discoveryClient discovery.DiscoveryInterface
mapper := restmapper.NewDeferredDiscoveryRESTMapper(cache)

// bootstrap non-crd resources
var transformers []TransformFileFunc
transformers := make([]TransformFileFunc, 0, len(opts))
for _, opt := range opts {
transformers = append(transformers, opt.TransformFile)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/indexers/servicebinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func IndexServiceBindingByKubeconfigSecret(obj any) ([]string, error) {

func ByServiceBindingKubeconfigSecretKey(binding *kubebindv1alpha1.APIServiceBinding) []string {
ps := binding.Spec.Providers
var secretRefs []string
secretRefs := make([]string, 0, len(ps))
for _, p := range ps {
secretRefs = append(secretRefs, p.Kubeconfig.Namespace+"/"+p.Kubeconfig.Name)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ func NewController(
if err != nil {
return nil, err
}
patched, err := provider.Client.Resource(gvr).Namespace(obj.GetNamespace()).Patch(ctx,
patched, err := provider.Client.Resource(gvr).Namespace(obj.GetNamespace()).Patch(
ctx,
obj.GetName(), types.ApplyPatchType, data, metav1.PatchOptions{FieldManager: applyManager, Force: ptr.To(true)},
)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/konnector/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ func (s *Prepared) OptionallyStartInformers(ctx context.Context) {
kubeBindSynced := s.Config.BindInformers.WaitForCacheSync(ctx.Done())
apiextensionsSynced := s.Config.ApiextensionsInformers.WaitForCacheSync(ctx.Done())

logger.Info("local informers are synced",
logger.Info(
"local informers are synced",
"kubeSynced", fmt.Sprintf("%v", kubeSynced),
"kubeBindSynced", fmt.Sprintf("%v", kubeBindSynced),
"apiextensionsSynced", fmt.Sprintf("%v", apiextensionsSynced),
Expand Down
3 changes: 2 additions & 1 deletion pkg/kubectl/bind-apiservice/plugin/servicebindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ func (b *BindAPIServiceOptions) createAPIServiceBindings(ctx context.Context, co
}

// best effort status update to have "Pending" in the Ready condition
conditions.MarkFalse(created,
conditions.MarkFalse(
created,
conditionsapi.ReadyCondition,
"Pending",
conditionsapi.ConditionSeverityInfo,
Expand Down
2 changes: 2 additions & 0 deletions pkg/kubectl/bind/plugin/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var (
"allow-missing-template-keys",
"kubeconfig",
"log-flush-frequency",
"log-text-info-buffer-size",
"log-text-split-stream",
"logging-format",
"o",
"output",
Expand Down
Loading