From 43e1fc99fdd5d02edfccb1c89f2f9319c543a81d Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Wed, 5 Jul 2023 22:26:30 +1000 Subject: [PATCH] Bump APIService to v1 --- .../apiregistration/v1beta1/apiservice/create.go | 2 +- .../apiregistration/v1beta1/apiservice/delete.go | 2 +- .../apiregistration/v1beta1/apiservice/generate.go | 10 +++++----- .../apiregistration/v1beta1/apiservice/read.go | 2 +- .../apiregistration/v1beta1/apiservice/update.go | 2 +- internal/resources/resources.go | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/resources/apiregistration/v1beta1/apiservice/create.go b/internal/resources/apiregistration/v1beta1/apiservice/create.go index 944c61ee..9ffce279 100644 --- a/internal/resources/apiregistration/v1beta1/apiservice/create.go +++ b/internal/resources/apiregistration/v1beta1/apiservice/create.go @@ -23,7 +23,7 @@ func Create(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Dia return diag.FromErr(err) } - out, err := conn.APIRegistration().ApiregistrationV1beta1().APIServices().Create(ctx, &service, metav1.CreateOptions{}) + out, err := conn.APIRegistration().ApiregistrationV1().APIServices().Create(ctx, &service, metav1.CreateOptions{}) if err != nil { return diag.FromErr(err) } diff --git a/internal/resources/apiregistration/v1beta1/apiservice/delete.go b/internal/resources/apiregistration/v1beta1/apiservice/delete.go index 0599601d..a0f1ecd6 100644 --- a/internal/resources/apiregistration/v1beta1/apiservice/delete.go +++ b/internal/resources/apiregistration/v1beta1/apiservice/delete.go @@ -23,7 +23,7 @@ func Delete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Dia return diag.FromErr(err) } - err = conn.APIRegistration().ApiregistrationV1beta1().APIServices().Delete(ctx, name, metav1.DeleteOptions{}) + err = conn.APIRegistration().ApiregistrationV1().APIServices().Delete(ctx, name, metav1.DeleteOptions{}) if err != nil { return diag.FromErr(err) } diff --git a/internal/resources/apiregistration/v1beta1/apiservice/generate.go b/internal/resources/apiregistration/v1beta1/apiservice/generate.go index cd2c374f..9ca8da8a 100644 --- a/internal/resources/apiregistration/v1beta1/apiservice/generate.go +++ b/internal/resources/apiregistration/v1beta1/apiservice/generate.go @@ -3,13 +3,13 @@ package apiservice import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - apiregistrationv1beta1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1" + apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" "github.com/previousnext/terraform-provider-k8s/internal/interfaceutils" ) // Generate the APIService. -func Generate(d *schema.ResourceData) (apiregistrationv1beta1.APIService, error) { +func Generate(d *schema.ResourceData) (apiregistrationv1.APIService, error) { var ( name = d.Get(FieldName).(string) rawLabels = d.Get(FieldLabels).(map[string]interface{}) @@ -22,13 +22,13 @@ func Generate(d *schema.ResourceData) (apiregistrationv1beta1.APIService, error) versionPriority = d.Get(FieldVersionPriority).(int) ) - crd := apiregistrationv1beta1.APIService{ + crd := apiregistrationv1.APIService{ ObjectMeta: metav1.ObjectMeta{ Name: name, Labels: interfaceutils.ExpandMap(rawLabels), }, - Spec: apiregistrationv1beta1.APIServiceSpec{ - Service: &apiregistrationv1beta1.ServiceReference{ + Spec: apiregistrationv1.APIServiceSpec{ + Service: &apiregistrationv1.ServiceReference{ Name: serviceName, Namespace: serviceNamespace, }, diff --git a/internal/resources/apiregistration/v1beta1/apiservice/read.go b/internal/resources/apiregistration/v1beta1/apiservice/read.go index 1d908a25..a6db8558 100644 --- a/internal/resources/apiregistration/v1beta1/apiservice/read.go +++ b/internal/resources/apiregistration/v1beta1/apiservice/read.go @@ -24,7 +24,7 @@ func Read(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagn return diag.FromErr(err) } - service, err := conn.APIRegistration().ApiregistrationV1beta1().APIServices().Get(ctx, name, metav1.GetOptions{}) + service, err := conn.APIRegistration().ApiregistrationV1().APIServices().Get(ctx, name, metav1.GetOptions{}) if kerrors.IsNotFound(err) { // This is how we tell Terraform that the resource does not exist. d.SetId("") diff --git a/internal/resources/apiregistration/v1beta1/apiservice/update.go b/internal/resources/apiregistration/v1beta1/apiservice/update.go index d4c82d8f..01940099 100644 --- a/internal/resources/apiregistration/v1beta1/apiservice/update.go +++ b/internal/resources/apiregistration/v1beta1/apiservice/update.go @@ -22,7 +22,7 @@ func Update(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Dia return diag.FromErr(err) } - _, err = conn.APIRegistration().ApiregistrationV1beta1().APIServices().Update(ctx, &service, metav1.UpdateOptions{}) + _, err = conn.APIRegistration().ApiregistrationV1().APIServices().Update(ctx, &service, metav1.UpdateOptions{}) if err != nil { return diag.FromErr(err) } diff --git a/internal/resources/resources.go b/internal/resources/resources.go index 9e76339d..5464cb40 100644 --- a/internal/resources/resources.go +++ b/internal/resources/resources.go @@ -56,7 +56,7 @@ const ( FieldCustomtResourceDefinition = "k8s_apiextensions_v1beta1_customresourcedefinition" // FieldAPIService identifier for the Kubernetes APIService. - FieldAPIService = "k8s_apiregistration_v1beta1_apiservice" + FieldAPIService = "k8s_apiregistration_v1_apiservice" // FieldPodDisruptionBudget identifier for the Kubernetes PodDisruptionBudget. FieldPodDisruptionBudget = "k8s_policy_v1beta1_poddisruptionbudget"