Skip to content

Commit

Permalink
fix(deps): use new pointer func (#982)
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
  • Loading branch information
oliverbaehler authored Feb 15, 2024
1 parent d1be14d commit dab0225
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 40 deletions.
6 changes: 3 additions & 3 deletions controllers/tls/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/util/retry"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -234,8 +234,8 @@ func (r *Reconciler) updateTenantCustomResourceDefinition(ctx context.Context, n
Service: &apiextensionsv1.ServiceReference{
Namespace: r.Namespace,
Name: "capsule-webhook-service",
Path: pointer.String("/convert"),
Port: pointer.Int32(443),
Path: ptr.To("/convert"),
Port: ptr.To(int32(443)),
},
CABundle: caBundle,
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/disable_externalname_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
"github.com/projectcapsule/capsule/pkg/api"
Expand All @@ -33,7 +33,7 @@ var _ = Describe("creating an ExternalName service when it is disabled for Tenan
},
ServiceOptions: &api.ServiceOptions{
AllowedServices: &api.AllowedServices{
ExternalName: pointer.Bool(false),
ExternalName: ptr.To(false),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/disable_loadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
"github.com/projectcapsule/capsule/pkg/api"
Expand All @@ -33,7 +33,7 @@ var _ = Describe("creating a LoadBalancer service when it is disabled for Tenant
},
ServiceOptions: &api.ServiceOptions{
AllowedServices: &api.AllowedServices{
LoadBalancer: pointer.Bool(false),
LoadBalancer: ptr.To(false),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/disable_node_ports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
"github.com/projectcapsule/capsule/pkg/api"
Expand All @@ -33,7 +33,7 @@ var _ = Describe("creating a nodePort service when it is disabled for Tenant", f
},
ServiceOptions: &api.ServiceOptions{
AllowedServices: &api.AllowedServices{
NodePort: pointer.Bool(false),
NodePort: ptr.To(false),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/enable_loadbalancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
"github.com/projectcapsule/capsule/pkg/api"
Expand All @@ -33,7 +33,7 @@ var _ = Describe("creating a LoadBalancer service when it is enabled for Tenant"
},
ServiceOptions: &api.ServiceOptions{
AllowedServices: &api.AllowedServices{
LoadBalancer: pointer.Bool(true),
LoadBalancer: ptr.To(true),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/globaltenantresource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
Expand Down Expand Up @@ -83,7 +83,7 @@ var _ = Describe("Creating a GlobalTenantResource object", func() {
},
TenantResourceSpec: capsulev1beta2.TenantResourceSpec{
ResyncPeriod: metav1.Duration{Duration: time.Minute},
PruningOnDelete: pointer.Bool(true),
PruningOnDelete: ptr.To(true),
Resources: []capsulev1beta2.ResourceSpec{
{
NamespacedItems: []capsulev1beta2.ObjectReference{
Expand Down
4 changes: 2 additions & 2 deletions e2e/ingress_class_extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
"github.com/projectcapsule/capsule/pkg/api"
Expand Down Expand Up @@ -131,7 +131,7 @@ var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1",
Name: "denied-ingress",
},
Spec: extensionsv1beta1.IngressSpec{
IngressClassName: pointer.String("the-worst-ingress-available"),
IngressClassName: ptr.To("the-worst-ingress-available"),
Backend: &extensionsv1beta1.IngressBackend{
ServiceName: "foo",
ServicePort: intstr.FromInt(8080),
Expand Down
4 changes: 2 additions & 2 deletions e2e/ingress_class_networking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
Expand Down Expand Up @@ -220,7 +220,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
Name: "denied-ingress",
},
Spec: networkingv1.IngressSpec{
IngressClassName: pointer.String("the-worst-ingress-available"),
IngressClassName: ptr.To("the-worst-ingress-available"),
DefaultBackend: &networkingv1.IngressBackend{
Service: &networkingv1.IngressServiceBackend{
Name: "foo",
Expand Down
4 changes: 2 additions & 2 deletions e2e/overquota_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
)
Expand All @@ -29,7 +29,7 @@ var _ = Describe("creating a Namespace in over-quota of three", func() {
},
},
NamespaceOptions: &capsulev1beta2.NamespaceOptions{
Quota: pointer.Int32(3),
Quota: ptr.To(int32(3)),
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions e2e/preventing_pv_cross_tenant_mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
Expand Down Expand Up @@ -84,7 +84,7 @@ var _ = Describe("preventing PersistentVolume cross-tenant mount", func() {
corev1.ResourceStorage: resource.MustParse("1Gi"),
},
},
StorageClassName: pointer.String("standard"),
StorageClassName: ptr.To("standard"),
},
}

Expand Down Expand Up @@ -167,7 +167,7 @@ var _ = Describe("preventing PersistentVolume cross-tenant mount", func() {
return k8sClient.Update(context.Background(), &pv)
}, defaultTimeoutInterval, defaultPollInterval).Should(Succeed())

Expect(k8sClient.Delete(context.Background(), &pod, &client.DeleteOptions{GracePeriodSeconds: pointer.Int64(0)})).ToNot(HaveOccurred())
Expect(k8sClient.Delete(context.Background(), &pod, &client.DeleteOptions{GracePeriodSeconds: ptr.To(int64(0))})).ToNot(HaveOccurred())

ns2 := NewNamespace("")
NamespaceCreation(ns2, tnt2.Spec.Owners[0], defaultTimeoutInterval).Should(Succeed())
Expand All @@ -188,7 +188,7 @@ var _ = Describe("preventing PersistentVolume cross-tenant mount", func() {
corev1.ResourceStorage: resource.MustParse("1Gi"),
},
},
StorageClassName: pointer.String("standard"),
StorageClassName: ptr.To("standard"),
VolumeName: pv.Name,
},
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/resource_quota_exceeded_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
)
Expand Down Expand Up @@ -135,7 +135,7 @@ var _ = Describe("exceeding a Tenant resource quota", func() {
Name: "my-pause",
},
Spec: appsv1.DeploymentSpec{
Replicas: pointer.Int32(5),
Replicas: ptr.To(int32(5)),
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "pause",
Expand Down
10 changes: 5 additions & 5 deletions e2e/service_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
Expand Down Expand Up @@ -269,8 +269,8 @@ var _ = Describe("adding metadata to Service objects", func() {
},
Ports: []discoveryv1beta1.EndpointPort{
{
Name: pointer.String("foo"),
Port: pointer.Int32(9999),
Name: ptr.To("foo"),
Port: ptr.To(int32(9999)),
},
},
}
Expand All @@ -288,8 +288,8 @@ var _ = Describe("adding metadata to Service objects", func() {
},
Ports: []discoveryv1.EndpointPort{
{
Name: pointer.String("foo"),
Port: pointer.Int32(9999),
Name: ptr.To("foo"),
Port: ptr.To(int32(9999)),
},
},
}
Expand Down
5 changes: 3 additions & 2 deletions e2e/storage_class_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
Expand Down Expand Up @@ -230,13 +230,14 @@ var _ = Describe("when Tenant handles Storage classes", func() {
TenantNamespaceList(tntNoDefaults, defaultTimeoutInterval).Should(ContainElement(ns.GetName()))
By("using exact matches", func() {
for _, c := range tntNoDefaults.Spec.StorageClasses.Exact {

Eventually(func() (err error) {
p := &corev1.PersistentVolumeClaim{
ObjectMeta: metav1.ObjectMeta{
Name: c,
},
Spec: corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String(c),
StorageClassName: ptr.To(c),
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},
Resources: corev1.ResourceRequirements{
Requests: map[corev1.ResourceName]resource.Quantity{
Expand Down
4 changes: 2 additions & 2 deletions e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/envtest"
Expand Down Expand Up @@ -43,7 +43,7 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
UseExistingCluster: pointer.Bool(true),
UseExistingCluster: ptr.To(true),
}

var err error
Expand Down
6 changes: 3 additions & 3 deletions e2e/tenantresource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
Expand Down Expand Up @@ -77,7 +77,7 @@ var _ = Describe("Creating a TenantResource object", func() {
},
Spec: capsulev1beta2.TenantResourceSpec{
ResyncPeriod: metav1.Duration{Duration: time.Minute},
PruningOnDelete: pointer.Bool(true),
PruningOnDelete: ptr.To(true),
Resources: []capsulev1beta2.ResourceSpec{
{
NamespaceSelector: &metav1.LabelSelector{
Expand Down Expand Up @@ -371,7 +371,7 @@ var _ = Describe("Creating a TenantResource object", func() {
Expect(k8sClient.Get(context.TODO(), types.NamespacedName{Name: tr.GetName(), Namespace: "solar-system"}, tr)).ToNot(HaveOccurred())
Expect(*tr.Spec.PruningOnDelete).Should(BeTrue())

tr.Spec.PruningOnDelete = pointer.Bool(false)
tr.Spec.PruningOnDelete = ptr.To(false)

Expect(k8sClient.Update(context.TODO(), tr)).ToNot(HaveOccurred())

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
k8s.io/apiextensions-apiserver v0.28.4
k8s.io/apimachinery v0.28.4
k8s.io/client-go v0.28.4
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
sigs.k8s.io/cluster-api v1.6.1
sigs.k8s.io/controller-runtime v0.16.3
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg=
k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ=
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM=
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk=
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/cluster-api v1.6.1 h1:I34p/fwgRlEhs+o9cUhKXDwNNfPS3no0yJsd2bJyQVc=
sigs.k8s.io/cluster-api v1.6.1/go.mod h1:DaxwruDvSaEYq5q6FREDaGzX6UsAVUCA99Sp8vfMHyQ=
sigs.k8s.io/controller-runtime v0.16.3 h1:2TuvuokmfXvDUamSx1SuAOO3eTyye+47mJCigwG62c4=
Expand Down

0 comments on commit dab0225

Please sign in to comment.