Просмотр исходного кода

updated batchv1beta1 to batchv1, also ran go fmt for whole package (#2718)

Stefan McShane 3 лет назад
Родитель
Сommit
ea45c1dcdc

+ 1 - 0
api/server/handlers/credentials/get_credentials_ce.go

@@ -1,3 +1,4 @@
+//go:build !ee
 // +build !ee
 
 package credentials

+ 1 - 0
api/server/handlers/credentials/get_credentials_ee.go

@@ -1,3 +1,4 @@
+//go:build ee
 // +build ee
 
 package credentials

+ 1 - 0
api/server/handlers/invite/invite_ce.go

@@ -1,3 +1,4 @@
+//go:build !ee
 // +build !ee
 
 package invite

+ 1 - 0
api/server/handlers/invite/invite_ee.go

@@ -1,3 +1,4 @@
+//go:build ee
 // +build ee
 
 package invite

+ 1 - 0
api/server/shared/config/loader/init_ce.go

@@ -1,3 +1,4 @@
+//go:build !ee
 // +build !ee
 
 package loader

+ 10 - 10
api/types/integrations.go

@@ -5,17 +5,17 @@ package types
 // auth mechanisms. For example, a GKE integration can have both an "oauth" mechanism
 // and a "gcp" mechanism:
 //
-// PorterIntegration{
-// 	AuthMechanism: "oauth",
-// 	Category: "cluster",
-// 	Service: GKE,
-// }
+//	PorterIntegration{
+//		AuthMechanism: "oauth",
+//		Category: "cluster",
+//		Service: GKE,
+//	}
 //
-// PorterIntegration{
-// 	AuthMechanism: "gcp",
-// 	Category: "cluster",
-// 	Service: GKE,
-// }
+//	PorterIntegration{
+//		AuthMechanism: "gcp",
+//		Category: "cluster",
+//		Service: GKE,
+//	}
 type PorterIntegration struct {
 	AuthMechanism string `json:"auth_mechanism"`
 	Category      string `json:"category"`

+ 4 - 4
cli/cmd/deploy/deploy.go

@@ -153,10 +153,10 @@ type GetBuildEnvOpts struct {
 // GetBuildEnv retrieves the build env from the release config and returns it.
 //
 // It returns a flattened map of all environment variables including:
-//    1. container.env.normal from the release config
-//    2. container.env.build from the release config
-//    3. container.env.synced from the release config
-//    4. any additional env var that was passed into the DeployAgent as opts.SharedOpts.AdditionalEnv
+//  1. container.env.normal from the release config
+//  2. container.env.build from the release config
+//  3. container.env.synced from the release config
+//  4. any additional env var that was passed into the DeployAgent as opts.SharedOpts.AdditionalEnv
 func (d *DeployAgent) GetBuildEnv(opts *GetBuildEnvOpts) (map[string]string, error) {
 	conf := d.Release.Config
 

+ 5 - 6
cli/cmd/run.go

@@ -15,7 +15,6 @@ import (
 	"github.com/porter-dev/porter/cli/cmd/utils"
 	"github.com/spf13/cobra"
 	batchv1 "k8s.io/api/batch/v1"
-	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	v1 "k8s.io/api/core/v1"
 	rbacv1 "k8s.io/api/rbac/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -573,7 +572,7 @@ func checkForPodDeletionCronJob(config *PorterRunSharedConfig) error {
 	}
 
 	for _, namespace := range namespaces.Items {
-		cronJobs, err := config.Clientset.BatchV1beta1().CronJobs(namespace.Name).List(
+		cronJobs, err := config.Clientset.BatchV1().CronJobs(namespace.Name).List(
 			context.Background(), metav1.ListOptions{},
 		)
 		if err != nil {
@@ -589,7 +588,7 @@ func checkForPodDeletionCronJob(config *PorterRunSharedConfig) error {
 		} else {
 			for _, cronJob := range cronJobs.Items {
 				if cronJob.Name == "porter-ephemeral-pod-deletion-cronjob" {
-					err = config.Clientset.BatchV1beta1().CronJobs(namespace.Name).Delete(
+					err = config.Clientset.BatchV1().CronJobs(namespace.Name).Delete(
 						context.Background(), cronJob.Name, metav1.DeleteOptions{},
 					)
 					if err != nil {
@@ -606,9 +605,9 @@ func checkForPodDeletionCronJob(config *PorterRunSharedConfig) error {
 		ObjectMeta: metav1.ObjectMeta{
 			Name: "porter-ephemeral-pod-deletion-cronjob",
 		},
-		Spec: batchv1beta1.CronJobSpec{
+		Spec: batchv1.CronJobSpec{
 			Schedule: "0 * * * *",
-			JobTemplate: batchv1beta1.JobTemplateSpec{
+			JobTemplate: batchv1.JobTemplateSpec{
 				Spec: batchv1.JobSpec{
 					Template: v1.PodTemplateSpec{
 						Spec: v1.PodSpec{
@@ -628,7 +627,7 @@ func checkForPodDeletionCronJob(config *PorterRunSharedConfig) error {
 			},
 		},
 	}
-	_, err = config.Clientset.BatchV1beta1().CronJobs("default").Create(
+	_, err = config.Clientset.BatchV1().CronJobs("default").Create(
 		context.Background(), cronJob, metav1.CreateOptions{},
 	)
 	if err != nil {

+ 1 - 1
cli/cmd/utils/close.go

@@ -9,7 +9,7 @@ import (
 )
 
 func closeHandler(closer func() error) {
-	sig := make(chan os.Signal)
+	sig := make(chan os.Signal, 1)
 	signal.Notify(sig, os.Interrupt, syscall.SIGTERM)
 	go func() {
 		<-sig

+ 1 - 0
cmd/migrate/migrate_ce.go

@@ -1,3 +1,4 @@
+//go:build !ee
 // +build !ee
 
 package main

+ 1 - 0
cmd/migrate/migrate_ee.go

@@ -1,3 +1,4 @@
+//go:build ee
 // +build ee
 
 package main

+ 2 - 2
internal/analytics/segment.go

@@ -59,8 +59,8 @@ func (c *AnalyticsSegment) Identify(identifier segmentIdentifier) error {
 	return err
 }
 
-//	Superset of segment client track function, this will accept analytics defined tracks only
-//	and will log an error if the client is not initialized
+// Superset of segment client track function, this will accept analytics defined tracks only
+// and will log an error if the client is not initialized
 func (c *AnalyticsSegment) Track(track segmentTrack) error {
 	if !c.isEnabled {
 		c.logger.Error().Msg("Analytics not enabled")

+ 2 - 3
internal/kubernetes/agent.go

@@ -26,7 +26,6 @@ import (
 	"github.com/porter-dev/porter/internal/helm/grapher"
 	appsv1 "k8s.io/api/apps/v1"
 	batchv1 "k8s.io/api/batch/v1"
-	batchv1beta1 "k8s.io/api/batch/v1beta1"
 	v1 "k8s.io/api/core/v1"
 	v1beta1 "k8s.io/api/extensions/v1beta1"
 	netv1 "k8s.io/api/networking/v1"
@@ -1080,8 +1079,8 @@ func (a *Agent) GetJob(c grapher.Object) (*batchv1.Job, error) {
 }
 
 // GetCronJob gets the CronJob by name and namespace
-func (a *Agent) GetCronJob(c grapher.Object) (*batchv1beta1.CronJob, error) {
-	res, err := a.Clientset.BatchV1beta1().CronJobs(c.Namespace).Get(
+func (a *Agent) GetCronJob(c grapher.Object) (*batchv1.CronJob, error) {
+	res, err := a.Clientset.BatchV1().CronJobs(c.Namespace).Get(
 		context.TODO(),
 		c.Name,
 		metav1.GetOptions{},

+ 0 - 1
internal/kubernetes/kubeconfig.go

@@ -111,7 +111,6 @@ func GetRawConfigFromBytes(kubeconfig []byte) (*api.Config, error) {
 // (3) If a bearer token exists, uses bearer token auth mechanism
 // (4) If a username/password exist, uses basic auth mechanism
 // (5) Otherwise, the config gets skipped
-//
 func parseAuthInfoForResolvers(authInfo *api.AuthInfo) (authMechanism models.ClusterAuth, resolvers []models.ClusterResolver) {
 	resolvers = make([]models.ClusterResolver, 0)
 

+ 1 - 0
internal/usage/limit_ce.go

@@ -1,3 +1,4 @@
+//go:build !ee
 // +build !ee
 
 package usage

+ 1 - 0
internal/usage/limit_ee.go

@@ -1,3 +1,4 @@
+//go:build ee
 // +build ee
 
 package usage

+ 1 - 0
provisioner/server/config/init_ce.go

@@ -1,3 +1,4 @@
+//go:build !ee
 // +build !ee
 
 package config

+ 1 - 0
provisioner/server/config/init_ee.go

@@ -1,3 +1,4 @@
+//go:build ee
 // +build ee
 
 package config

+ 1 - 0
provisioner/server/handlers/credentials/get_credentials_ce.go

@@ -1,3 +1,4 @@
+//go:build !ee
 // +build !ee
 
 package credentials