mirror of https://github.com/k3s-io/k3s
Transition from deprecated pointer library to ptr (#9801)
Signed-off-by: Derek Nola <derek.nola@suse.com>pull/9838/head
parent
5d69d6e782
commit
14f54d0b26
2
go.mod
2
go.mod
|
@ -179,7 +179,7 @@ require (
|
|||
k8s.io/kube-proxy v0.0.0
|
||||
k8s.io/kubectl v0.25.0
|
||||
k8s.io/kubernetes v1.29.3
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
|
||||
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
|
|
3
go.sum
3
go.sum
|
@ -2172,8 +2172,9 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A
|
|||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY=
|
||||
k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI=
|
||||
lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
|
||||
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
|
||||
|
|
|
@ -48,7 +48,7 @@ import (
|
|||
app2 "k8s.io/kubernetes/cmd/kube-proxy/app"
|
||||
kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config"
|
||||
utilsnet "k8s.io/utils/net"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
utilsptr "k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
|
||||
|
@ -201,8 +201,8 @@ func run(ctx context.Context, cfg cmds.Agent, proxy proxy.Proxy) error {
|
|||
// When running rootless, we do not attempt to set conntrack sysctls - this behavior is copied from kubeadm.
|
||||
func getConntrackConfig(nodeConfig *daemonconfig.Node) (*kubeproxyconfig.KubeProxyConntrackConfiguration, error) {
|
||||
ctConfig := &kubeproxyconfig.KubeProxyConntrackConfiguration{
|
||||
MaxPerCore: utilpointer.Int32Ptr(0),
|
||||
Min: utilpointer.Int32Ptr(0),
|
||||
MaxPerCore: utilsptr.To(int32(0)),
|
||||
Min: utilsptr.To(int32(0)),
|
||||
TCPEstablishedTimeout: &metav1.Duration{},
|
||||
TCPCloseWaitTimeout: &metav1.Duration{},
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
v1alpha1 "k8s.io/kube-proxy/config/v1alpha1"
|
||||
kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config"
|
||||
kubeproxyconfigv1alpha1 "k8s.io/kubernetes/pkg/proxy/apis/config/v1alpha1"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
utilsptr "k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func Test_UnitGetConntrackConfig(t *testing.T) {
|
||||
|
@ -23,7 +23,7 @@ func Test_UnitGetConntrackConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
customConfig := defaultConfig.DeepCopy()
|
||||
customConfig.Conntrack.Min = utilpointer.Int32Ptr(100)
|
||||
customConfig.Conntrack.Min = utilsptr.To(int32(100))
|
||||
customConfig.Conntrack.TCPCloseWaitTimeout.Duration = 42 * time.Second
|
||||
|
||||
type args struct {
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"github.com/k3s-io/k3s/pkg/version"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func commandPrep(cfg *cmds.Server) (*clientaccess.Info, error) {
|
||||
|
@ -54,7 +54,7 @@ func Enable(app *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b, err := json.Marshal(server.EncryptionRequest{Enable: pointer.Bool(true)})
|
||||
b, err := json.Marshal(server.EncryptionRequest{Enable: ptr.To(true)})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ func Disable(app *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b, err := json.Marshal(server.EncryptionRequest{Enable: pointer.Bool(false)})
|
||||
b, err := json.Marshal(server.EncryptionRequest{Enable: ptr.To(false)})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ func Prepare(app *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
b, err := json.Marshal(server.EncryptionRequest{
|
||||
Stage: pointer.String(secretsencrypt.EncryptionPrepare),
|
||||
Stage: ptr.To(secretsencrypt.EncryptionPrepare),
|
||||
Force: cmds.ServerConfig.EncryptForce,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -177,7 +177,7 @@ func Rotate(app *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
b, err := json.Marshal(server.EncryptionRequest{
|
||||
Stage: pointer.String(secretsencrypt.EncryptionRotate),
|
||||
Stage: ptr.To(secretsencrypt.EncryptionRotate),
|
||||
Force: cmds.ServerConfig.EncryptForce,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -199,7 +199,7 @@ func Reencrypt(app *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
b, err := json.Marshal(server.EncryptionRequest{
|
||||
Stage: pointer.String(secretsencrypt.EncryptionReencryptActive),
|
||||
Stage: ptr.To(secretsencrypt.EncryptionReencryptActive),
|
||||
Force: cmds.ServerConfig.EncryptForce,
|
||||
Skip: cmds.ServerConfig.EncryptSkip,
|
||||
})
|
||||
|
@ -222,7 +222,7 @@ func RotateKeys(app *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
b, err := json.Marshal(server.EncryptionRequest{
|
||||
Stage: pointer.String(secretsencrypt.EncryptionRotateKeys),
|
||||
Stage: ptr.To(secretsencrypt.EncryptionRotateKeys),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
"k8s.io/client-go/tools/clientcmd"
|
||||
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
|
||||
bootstraputil "k8s.io/cluster-bootstrap/token/util"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
func Create(app *cli.Context) error {
|
||||
|
@ -155,7 +155,7 @@ func Rotate(app *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
b, err := json.Marshal(server.TokenRotateRequest{
|
||||
NewToken: pointer.String(cmds.TokenConfig.NewToken),
|
||||
NewToken: ptr.To(cmds.TokenConfig.NewToken),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
servicehelper "k8s.io/cloud-provider/service/helpers"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
utilsnet "k8s.io/utils/net"
|
||||
utilpointer "k8s.io/utils/pointer"
|
||||
utilsptr "k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -488,7 +488,7 @@ func (k *k3s) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
|
|||
},
|
||||
Spec: core.PodSpec{
|
||||
ServiceAccountName: "svclb",
|
||||
AutomountServiceAccountToken: utilpointer.Bool(false),
|
||||
AutomountServiceAccountToken: utilsptr.To(false),
|
||||
SecurityContext: &core.PodSecurityContext{
|
||||
Sysctls: sysctls,
|
||||
},
|
||||
|
|
|
@ -42,7 +42,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/client-go/util/retry"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -1074,7 +1074,7 @@ func (sf *snapshotFile) toETCDSnapshotFile(esf *apisv1.ETCDSnapshotFile) {
|
|||
esf.Spec.SnapshotName = sf.Name
|
||||
esf.Spec.Location = sf.Location
|
||||
esf.Status.CreationTime = sf.CreatedAt
|
||||
esf.Status.ReadyToUse = pointer.Bool(sf.Status == successfulSnapshotStatus)
|
||||
esf.Status.ReadyToUse = ptr.To(sf.Status == successfulSnapshotStatus)
|
||||
esf.Status.Size = resource.NewQuantity(sf.Size, resource.DecimalSI)
|
||||
|
||||
if sf.nodeSource != "" {
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
v1 "k8s.io/api/core/v1"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -80,7 +80,7 @@ func Ensure(secretClient coreclient.SecretController, nodeName, pass string) err
|
|||
Name: getSecretName(nodeName),
|
||||
Namespace: metav1.NamespaceSystem,
|
||||
},
|
||||
Immutable: pointer.Bool(true),
|
||||
Immutable: ptr.To(true),
|
||||
Data: map[string][]byte{"hash": []byte(hash)},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/labels"
|
||||
apiserverconfigv1 "k8s.io/apiserver/pkg/apis/config/v1"
|
||||
"k8s.io/client-go/util/retry"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
const aescbcKeySize = 32
|
||||
|
@ -84,9 +84,9 @@ func encryptionStatus(server *config.Control) (EncryptionState, error) {
|
|||
return state, err
|
||||
}
|
||||
if providers[1].Identity != nil && providers[0].AESCBC != nil {
|
||||
state.Enable = pointer.Bool(true)
|
||||
state.Enable = ptr.To(true)
|
||||
} else if providers[0].Identity != nil && providers[1].AESCBC != nil || !server.EncryptSecrets {
|
||||
state.Enable = pointer.Bool(false)
|
||||
state.Enable = ptr.To(false)
|
||||
}
|
||||
|
||||
if err := verifyEncryptionHashAnnotation(server.Runtime, server.Runtime.Core.Core(), ""); err != nil {
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apiserver/pkg/authentication/authenticator"
|
||||
"k8s.io/apiserver/pkg/authentication/request/union"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
"github.com/go-logr/stdr"
|
||||
|
@ -141,7 +141,7 @@ func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error {
|
|||
if logrus.IsLevelEnabled(logrus.DebugLevel) {
|
||||
level = ipfslog.LevelDebug
|
||||
stdlog := log.New(logrus.StandardLogger().Writer(), "spegel ", log.LstdFlags)
|
||||
logger := stdr.NewWithOptions(stdlog, stdr.Options{Verbosity: pointer.Int(10)})
|
||||
logger := stdr.NewWithOptions(stdlog, stdr.Options{Verbosity: ptr.To(10)})
|
||||
ctx = logr.NewContext(ctx, logger)
|
||||
}
|
||||
ipfslog.SetAllLoggers(level)
|
||||
|
|
Loading…
Reference in New Issue