Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzu committed Dec 12, 2024
1 parent 30e6a25 commit 379e2d9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/incuscluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ func (r *IncusClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request
return r.reconcileNormal(ctx, cluster, incusCluster)
}

func (r *IncusClusterReconciler) reconcileDelete(_ context.Context, cluster *clusterv1.Cluster, incusCluster *infrav1alpha1.IncusCluster) error {
func (r *IncusClusterReconciler) reconcileDelete(_ context.Context, _ *clusterv1.Cluster, incusCluster *infrav1alpha1.IncusCluster) error {

Check failure on line 113 in internal/controller/incuscluster_controller.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

(*IncusClusterReconciler).reconcileDelete - result 0 (error) is always nil (unparam)
controllerutil.RemoveFinalizer(incusCluster, infrav1alpha1.ClusterFinalizer)

return nil
}

func (r *IncusClusterReconciler) reconcileNormal(ctx context.Context, cluster *clusterv1.Cluster, incusCluster *infrav1alpha1.IncusCluster) (ctrl.Result, error) {
func (r *IncusClusterReconciler) reconcileNormal(ctx context.Context, _ *clusterv1.Cluster, incusCluster *infrav1alpha1.IncusCluster) (ctrl.Result, error) {

Check failure on line 119 in internal/controller/incuscluster_controller.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

(*IncusClusterReconciler).reconcileNormal - result 1 (error) is always nil (unparam)
log := log.FromContext(ctx)

if incusCluster.Spec.ControlPlaneEndpoint.Host == "" {
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/incusmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func patchIncusMachine(ctx context.Context, patchHelper *patch.Helper, incusMach
)
}

func (r *IncusMachineReconciler) reconcileDelete(ctx context.Context, incusCluster *infrav1alpha1.IncusCluster, machine *clusterv1.Machine, incusMachine *infrav1alpha1.IncusMachine) (ctrl.Result, error) {
func (r *IncusMachineReconciler) reconcileDelete(ctx context.Context, _ *infrav1alpha1.IncusCluster, _ *clusterv1.Machine, incusMachine *infrav1alpha1.IncusMachine) (ctrl.Result, error) {
log := ctrl.LoggerFrom(ctx)

// If the IncusMachine is being deleted, handle its deletion.
Expand Down Expand Up @@ -222,7 +222,7 @@ func (r *IncusMachineReconciler) reconcileDelete(ctx context.Context, incusClust
}, nil
}

func (r *IncusMachineReconciler) reconcileNormal(ctx context.Context, cluster *clusterv1.Cluster, incusCluster *infrav1alpha1.IncusCluster, machine *clusterv1.Machine, incusMachine *infrav1alpha1.IncusMachine) (ctrl.Result, error) {
func (r *IncusMachineReconciler) reconcileNormal(ctx context.Context, cluster *clusterv1.Cluster, _ *infrav1alpha1.IncusCluster, machine *clusterv1.Machine, incusMachine *infrav1alpha1.IncusMachine) (ctrl.Result, error) {

Check failure on line 225 in internal/controller/incusmachine_controller.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

(*IncusMachineReconciler).reconcileNormal - result 0 (sigs.k8s.io/controller-runtime/pkg/reconcile.Result) is always nil (unparam)
log := ctrl.LoggerFrom(ctx)

// Check if the infrastructure is ready, otherwise return and wait for the cluster object to be updated
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,27 @@ var _ = Describe("Manager", Ordered, func() {
cmd := exec.Command("kubectl", "logs", controllerPodName, "-n", namespace)
controllerLogs, err := utils.Run(cmd)
if err == nil {
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Controller logs:\n %s", controllerLogs))
_, _ = fmt.Fprintf(GinkgoWriter, "Controller logs:\n %s", controllerLogs)
} else {
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Failed to get Controller logs: %s", err))
_, _ = fmt.Fprintf(GinkgoWriter, "Failed to get Controller logs: %s", err)
}

By("Fetching Kubernetes events")
cmd = exec.Command("kubectl", "get", "events", "-n", namespace, "--sort-by=.lastTimestamp")
eventsOutput, err := utils.Run(cmd)
if err == nil {
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Kubernetes events:\n%s", eventsOutput))
_, _ = fmt.Fprintf(GinkgoWriter, "Kubernetes events:\n%s", eventsOutput)
} else {
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Failed to get Kubernetes events: %s", err))
_, _ = fmt.Fprintf(GinkgoWriter, "Failed to get Kubernetes events: %s", err)
}

By("Fetching curl-metrics logs")
cmd = exec.Command("kubectl", "logs", "curl-metrics", "-n", namespace)
metricsOutput, err := utils.Run(cmd)
if err == nil {
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Metrics logs:\n %s", metricsOutput))
_, _ = fmt.Fprintf(GinkgoWriter, "Metrics logs:\n %s", metricsOutput)
} else {
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Failed to get curl-metrics logs: %s", err))
_, _ = fmt.Fprintf(GinkgoWriter, "Failed to get curl-metrics logs: %s", err)
}

By("Fetching controller manager pod description")
Expand Down Expand Up @@ -278,7 +278,7 @@ func serviceAccountToken() (string, error) {

// Parse the JSON output to extract the token
var token tokenRequest
err = json.Unmarshal([]byte(output), &token)
err = json.Unmarshal(output, &token)
g.Expect(err).NotTo(HaveOccurred())

out = token.Status.Token
Expand Down
4 changes: 2 additions & 2 deletions test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func IsPrometheusCRDsInstalled() bool {
if err != nil {
return false
}
crdList := GetNonEmptyLines(string(output))
crdList := GetNonEmptyLines(output)
for _, crd := range prometheusCRDs {
for _, line := range crdList {
if strings.Contains(line, crd) {
Expand Down Expand Up @@ -153,7 +153,7 @@ func IsCertManagerCRDsInstalled() bool {
}

// Check if any of the Cert Manager CRDs are present
crdList := GetNonEmptyLines(string(output))
crdList := GetNonEmptyLines(output)
for _, crd := range certManagerCRDs {
for _, line := range crdList {
if strings.Contains(line, crd) {
Expand Down

0 comments on commit 379e2d9

Please sign in to comment.