From f492ccc7f6185b57c39ceacc2886414610678da1 Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Thu, 29 Aug 2024 07:15:22 +0100 Subject: [PATCH] (deployimage/v1apha1): fix linter issues --- .../controller/memcached_controller.go | 48 +++++++++---------- .../templates/controllers/controller.go | 48 +++++++++---------- .../internal/controller/busybox_controller.go | 48 +++++++++---------- .../controller/memcached_controller.go | 48 +++++++++---------- 4 files changed, 96 insertions(+), 96 deletions(-) diff --git a/docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller.go b/docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller.go index 62af9157efb..ffb7560aaf1 100644 --- a/docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller.go +++ b/docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller.go @@ -305,7 +305,7 @@ func (r *MemcachedReconciler) doFinalizerOperationsForMemcached(cr *cachev1alpha // deploymentForMemcached returns a Memcached Deployment object func (r *MemcachedReconciler) deploymentForMemcached( memcached *cachev1alpha1.Memcached) (*appsv1.Deployment, error) { - ls := labelsForMemcached(memcached.Name) + ls := labelsForMemcached() replicas := memcached.Spec.Size // Get the Operand image @@ -335,28 +335,28 @@ func (r *MemcachedReconciler) deploymentForMemcached( // makefile target docker-buildx. Also, you can use docker manifest inspect // to check what are the platforms supported. // More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity - //Affinity: &corev1.Affinity{ - // NodeAffinity: &corev1.NodeAffinity{ - // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ - // NodeSelectorTerms: []corev1.NodeSelectorTerm{ - // { - // MatchExpressions: []corev1.NodeSelectorRequirement{ - // { - // Key: "kubernetes.io/arch", - // Operator: "In", - // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, - // }, - // { - // Key: "kubernetes.io/os", - // Operator: "In", - // Values: []string{"linux"}, - // }, - // }, - // }, - // }, - // }, - // }, - //}, + // Affinity: &corev1.Affinity{ + // NodeAffinity: &corev1.NodeAffinity{ + // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ + // NodeSelectorTerms: []corev1.NodeSelectorTerm{ + // { + // MatchExpressions: []corev1.NodeSelectorRequirement{ + // { + // Key: "kubernetes.io/arch", + // Operator: "In", + // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, + // }, + // { + // Key: "kubernetes.io/os", + // Operator: "In", + // Values: []string{"linux"}, + // }, + // }, + // }, + // }, + // }, + // }, + // }, SecurityContext: &corev1.PodSecurityContext{ RunAsNonRoot: &[]bool{true}[0], // IMPORTANT: seccomProfile was introduced with Kubernetes 1.19 @@ -403,7 +403,7 @@ func (r *MemcachedReconciler) deploymentForMemcached( // labelsForMemcached returns the labels for selecting the resources // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/ -func labelsForMemcached(name string) map[string]string { +func labelsForMemcached() map[string]string { var imageTag string image, err := imageForMemcached() if err == nil { diff --git a/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/controllers/controller.go b/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/controllers/controller.go index ddbd43508ae..6c8d4769ac4 100644 --- a/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/controllers/controller.go +++ b/pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/controllers/controller.go @@ -359,7 +359,7 @@ func (r *{{ .Resource.Kind }}Reconciler) doFinalizerOperationsFor{{ .Resource.Ki // deploymentFor{{ .Resource.Kind }} returns a {{ .Resource.Kind }} Deployment object func (r *{{ .Resource.Kind }}Reconciler) deploymentFor{{ .Resource.Kind }}( {{ lower .Resource.Kind }} *{{ .Resource.ImportAlias }}.{{ .Resource.Kind }}) (*appsv1.Deployment, error) { - ls := labelsFor{{ .Resource.Kind }}({{ lower .Resource.Kind }}.Name) + ls := labelsFor{{ .Resource.Kind }}() replicas := {{ lower .Resource.Kind }}.Spec.Size // Get the Operand image @@ -389,28 +389,28 @@ func (r *{{ .Resource.Kind }}Reconciler) deploymentFor{{ .Resource.Kind }}( // makefile target docker-buildx. Also, you can use docker manifest inspect // to check what are the platforms supported. // More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity - //Affinity: &corev1.Affinity{ - // NodeAffinity: &corev1.NodeAffinity{ - // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ - // NodeSelectorTerms: []corev1.NodeSelectorTerm{ - // { - // MatchExpressions: []corev1.NodeSelectorRequirement{ - // { - // Key: "kubernetes.io/arch", - // Operator: "In", - // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, - // }, - // { - // Key: "kubernetes.io/os", - // Operator: "In", - // Values: []string{"linux"}, - // }, - // }, - // }, - // }, - // }, - // }, - //}, + // Affinity: &corev1.Affinity{ + // NodeAffinity: &corev1.NodeAffinity{ + // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ + // NodeSelectorTerms: []corev1.NodeSelectorTerm{ + // { + // MatchExpressions: []corev1.NodeSelectorRequirement{ + // { + // Key: "kubernetes.io/arch", + // Operator: "In", + // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, + // }, + // { + // Key: "kubernetes.io/os", + // Operator: "In", + // Values: []string{"linux"}, + // }, + // }, + // }, + // }, + // }, + // }, + // }, SecurityContext: &corev1.PodSecurityContext{ RunAsNonRoot: &[]bool{true}[0], // IMPORTANT: seccomProfile was introduced with Kubernetes 1.19 @@ -436,7 +436,7 @@ func (r *{{ .Resource.Kind }}Reconciler) deploymentFor{{ .Resource.Kind }}( // labelsFor{{ .Resource.Kind }} returns the labels for selecting the resources // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/ -func labelsFor{{ .Resource.Kind }}(name string) map[string]string { +func labelsFor{{ .Resource.Kind }}() map[string]string { var imageTag string image, err := imageFor{{ .Resource.Kind }}() if err == nil { diff --git a/testdata/project-v4-with-deploy-image/internal/controller/busybox_controller.go b/testdata/project-v4-with-deploy-image/internal/controller/busybox_controller.go index d47b263bba1..2c2bbca8f77 100644 --- a/testdata/project-v4-with-deploy-image/internal/controller/busybox_controller.go +++ b/testdata/project-v4-with-deploy-image/internal/controller/busybox_controller.go @@ -305,7 +305,7 @@ func (r *BusyboxReconciler) doFinalizerOperationsForBusybox(cr *examplecomv1alph // deploymentForBusybox returns a Busybox Deployment object func (r *BusyboxReconciler) deploymentForBusybox( busybox *examplecomv1alpha1.Busybox) (*appsv1.Deployment, error) { - ls := labelsForBusybox(busybox.Name) + ls := labelsForBusybox() replicas := busybox.Spec.Size // Get the Operand image @@ -335,28 +335,28 @@ func (r *BusyboxReconciler) deploymentForBusybox( // makefile target docker-buildx. Also, you can use docker manifest inspect // to check what are the platforms supported. // More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity - //Affinity: &corev1.Affinity{ - // NodeAffinity: &corev1.NodeAffinity{ - // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ - // NodeSelectorTerms: []corev1.NodeSelectorTerm{ - // { - // MatchExpressions: []corev1.NodeSelectorRequirement{ - // { - // Key: "kubernetes.io/arch", - // Operator: "In", - // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, - // }, - // { - // Key: "kubernetes.io/os", - // Operator: "In", - // Values: []string{"linux"}, - // }, - // }, - // }, - // }, - // }, - // }, - //}, + // Affinity: &corev1.Affinity{ + // NodeAffinity: &corev1.NodeAffinity{ + // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ + // NodeSelectorTerms: []corev1.NodeSelectorTerm{ + // { + // MatchExpressions: []corev1.NodeSelectorRequirement{ + // { + // Key: "kubernetes.io/arch", + // Operator: "In", + // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, + // }, + // { + // Key: "kubernetes.io/os", + // Operator: "In", + // Values: []string{"linux"}, + // }, + // }, + // }, + // }, + // }, + // }, + // }, SecurityContext: &corev1.PodSecurityContext{ RunAsNonRoot: &[]bool{true}[0], // IMPORTANT: seccomProfile was introduced with Kubernetes 1.19 @@ -397,7 +397,7 @@ func (r *BusyboxReconciler) deploymentForBusybox( // labelsForBusybox returns the labels for selecting the resources // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/ -func labelsForBusybox(name string) map[string]string { +func labelsForBusybox() map[string]string { var imageTag string image, err := imageForBusybox() if err == nil { diff --git a/testdata/project-v4-with-deploy-image/internal/controller/memcached_controller.go b/testdata/project-v4-with-deploy-image/internal/controller/memcached_controller.go index b66a83a657f..a2c6b880397 100644 --- a/testdata/project-v4-with-deploy-image/internal/controller/memcached_controller.go +++ b/testdata/project-v4-with-deploy-image/internal/controller/memcached_controller.go @@ -305,7 +305,7 @@ func (r *MemcachedReconciler) doFinalizerOperationsForMemcached(cr *examplecomv1 // deploymentForMemcached returns a Memcached Deployment object func (r *MemcachedReconciler) deploymentForMemcached( memcached *examplecomv1alpha1.Memcached) (*appsv1.Deployment, error) { - ls := labelsForMemcached(memcached.Name) + ls := labelsForMemcached() replicas := memcached.Spec.Size // Get the Operand image @@ -335,28 +335,28 @@ func (r *MemcachedReconciler) deploymentForMemcached( // makefile target docker-buildx. Also, you can use docker manifest inspect // to check what are the platforms supported. // More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity - //Affinity: &corev1.Affinity{ - // NodeAffinity: &corev1.NodeAffinity{ - // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ - // NodeSelectorTerms: []corev1.NodeSelectorTerm{ - // { - // MatchExpressions: []corev1.NodeSelectorRequirement{ - // { - // Key: "kubernetes.io/arch", - // Operator: "In", - // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, - // }, - // { - // Key: "kubernetes.io/os", - // Operator: "In", - // Values: []string{"linux"}, - // }, - // }, - // }, - // }, - // }, - // }, - //}, + // Affinity: &corev1.Affinity{ + // NodeAffinity: &corev1.NodeAffinity{ + // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ + // NodeSelectorTerms: []corev1.NodeSelectorTerm{ + // { + // MatchExpressions: []corev1.NodeSelectorRequirement{ + // { + // Key: "kubernetes.io/arch", + // Operator: "In", + // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, + // }, + // { + // Key: "kubernetes.io/os", + // Operator: "In", + // Values: []string{"linux"}, + // }, + // }, + // }, + // }, + // }, + // }, + // }, SecurityContext: &corev1.PodSecurityContext{ RunAsNonRoot: &[]bool{true}[0], // IMPORTANT: seccomProfile was introduced with Kubernetes 1.19 @@ -403,7 +403,7 @@ func (r *MemcachedReconciler) deploymentForMemcached( // labelsForMemcached returns the labels for selecting the resources // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/ -func labelsForMemcached(name string) map[string]string { +func labelsForMemcached() map[string]string { var imageTag string image, err := imageForMemcached() if err == nil {