mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-25 08:50:45 +00:00
Upgrade Operator SDK to v1.34.1 and update dependencies (#185)
This does the following updates: * Upgrade to Operator SDK v1.34.1. This fixes building multi-arch images from Makefile. Check this MR from operator-framework for details. * Update Go dependencies. This addresses Dependabot alert ["Golang protojson.Unmarshal function infinite loop when unmarshaling certain forms of invalid JSON"](https://github.com/1Password/onepassword-operator/security/dependabot/13). * Update versions of the GitHub Actions used in the pipelines. * Update Kubernetes related tools (such as controller-tools version, and operator-sdk for ci pipelines) By updating dependencies, the pipelines no longer fail due to a panic error when running `make test`.
This commit is contained in:
16
vendor/sigs.k8s.io/controller-runtime/pkg/internal/field/selector/utils.go
generated
vendored
16
vendor/sigs.k8s.io/controller-runtime/pkg/internal/field/selector/utils.go
generated
vendored
@@ -22,14 +22,16 @@ import (
|
||||
)
|
||||
|
||||
// RequiresExactMatch checks if the given field selector is of the form `k=v` or `k==v`.
|
||||
func RequiresExactMatch(sel fields.Selector) (field, val string, required bool) {
|
||||
func RequiresExactMatch(sel fields.Selector) bool {
|
||||
reqs := sel.Requirements()
|
||||
if len(reqs) != 1 {
|
||||
return "", "", false
|
||||
if len(reqs) == 0 {
|
||||
return false
|
||||
}
|
||||
req := reqs[0]
|
||||
if req.Operator != selection.Equals && req.Operator != selection.DoubleEquals {
|
||||
return "", "", false
|
||||
|
||||
for _, req := range reqs {
|
||||
if req.Operator != selection.Equals && req.Operator != selection.DoubleEquals {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return req.Field, req.Value, true
|
||||
return true
|
||||
}
|
||||
|
||||
38
vendor/sigs.k8s.io/controller-runtime/pkg/internal/syncs/syncs.go
generated
vendored
Normal file
38
vendor/sigs.k8s.io/controller-runtime/pkg/internal/syncs/syncs.go
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
package syncs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// MergeChans returns a channel that is closed when any of the input channels are signaled.
|
||||
// The caller must call the returned CancelFunc to ensure no resources are leaked.
|
||||
func MergeChans[T any](chans ...<-chan T) (<-chan T, context.CancelFunc) {
|
||||
var once sync.Once
|
||||
out := make(chan T)
|
||||
cancel := make(chan T)
|
||||
cancelFunc := func() {
|
||||
once.Do(func() {
|
||||
close(cancel)
|
||||
})
|
||||
<-out
|
||||
}
|
||||
cases := make([]reflect.SelectCase, len(chans)+1)
|
||||
for i := range chans {
|
||||
cases[i] = reflect.SelectCase{
|
||||
Dir: reflect.SelectRecv,
|
||||
Chan: reflect.ValueOf(chans[i]),
|
||||
}
|
||||
}
|
||||
cases[len(cases)-1] = reflect.SelectCase{
|
||||
Dir: reflect.SelectRecv,
|
||||
Chan: reflect.ValueOf(cancel),
|
||||
}
|
||||
go func() {
|
||||
defer close(out)
|
||||
_, _, _ = reflect.Select(cases)
|
||||
}()
|
||||
|
||||
return out, cancelFunc
|
||||
}
|
||||
1
vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane/kubectl.go
generated
vendored
1
vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/controlplane/kubectl.go
generated
vendored
@@ -112,6 +112,7 @@ func (k *KubeCtl) Run(args ...string) (stdout, stderr io.Reader, err error) {
|
||||
cmd := exec.Command(k.Path, allArgs...)
|
||||
cmd.Stdout = stdoutBuffer
|
||||
cmd.Stderr = stderrBuffer
|
||||
cmd.SysProcAttr = process.GetSysProcAttr()
|
||||
|
||||
err = cmd.Run()
|
||||
|
||||
|
||||
28
vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/process/procattr_other.go
generated
vendored
Normal file
28
vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/process/procattr_other.go
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos
|
||||
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos
|
||||
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package process
|
||||
|
||||
import "syscall"
|
||||
|
||||
// GetSysProcAttr returns the SysProcAttr to use for the process,
|
||||
// for non-unix systems this returns nil.
|
||||
func GetSysProcAttr() *syscall.SysProcAttr {
|
||||
return nil
|
||||
}
|
||||
33
vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/process/procattr_unix.go
generated
vendored
Normal file
33
vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/process/procattr_unix.go
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||
|
||||
/*
|
||||
Copyright 2023 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package process
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// GetSysProcAttr returns the SysProcAttr to use for the process,
|
||||
// for unix systems this returns a SysProcAttr with Setpgid set to true,
|
||||
// which inherits the parent's process group id.
|
||||
func GetSysProcAttr() *unix.SysProcAttr {
|
||||
return &unix.SysProcAttr{
|
||||
Setpgid: true,
|
||||
}
|
||||
}
|
||||
4
vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/process/process.go
generated
vendored
4
vendor/sigs.k8s.io/controller-runtime/pkg/internal/testing/process/process.go
generated
vendored
@@ -155,6 +155,7 @@ func (ps *State) Start(stdout, stderr io.Writer) (err error) {
|
||||
ps.Cmd = exec.Command(ps.Path, ps.Args...)
|
||||
ps.Cmd.Stdout = stdout
|
||||
ps.Cmd.Stderr = stderr
|
||||
ps.Cmd.SysProcAttr = GetSysProcAttr()
|
||||
|
||||
ready := make(chan bool)
|
||||
timedOut := time.After(ps.StartTimeout)
|
||||
@@ -265,6 +266,9 @@ func (ps *State) Stop() error {
|
||||
case <-ps.waitDone:
|
||||
break
|
||||
case <-timedOut:
|
||||
if err := ps.Cmd.Process.Signal(syscall.SIGKILL); err != nil {
|
||||
return fmt.Errorf("unable to kill process %s: %w", ps.Path, err)
|
||||
}
|
||||
return fmt.Errorf("timeout waiting for process %s to stop", path.Base(ps.Path))
|
||||
}
|
||||
ps.ready = false
|
||||
|
||||
Reference in New Issue
Block a user