Skip to content

Commit

Permalink
Update after code review
Browse files Browse the repository at this point in the history
Signed-off-by: Xavi Garcia <[email protected]>
  • Loading branch information
0xavi0 committed Oct 1, 2024
1 parent bc3b782 commit 453ceea
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions charts/fleet-crd/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6891,8 +6891,8 @@ spec:
format: int64
type: integer
webhookCommit:
description: WebhookCommit is the Git commit hash from the last
git commit received from a webhook
description: WebhookCommit is the latest Git commit hash received
from a webhook
nullable: true
type: string
type: object
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ require (
github.com/prometheus/common v0.59.1
github.com/rancher/fleet/pkg/apis v0.10.0
github.com/rancher/lasso v0.0.0-20240828170735-d79536cac289
github.com/rancher/wrangler v1.1.2
github.com/rancher/wrangler/v3 v3.0.0
github.com/reugn/go-quartz v0.11.2
github.com/sirupsen/logrus v1.9.3
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,6 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rancher/lasso v0.0.0-20240828170735-d79536cac289 h1:gbV7qLOcEgyTgep2ocl8FFhfGOUMQuvfV5OIIENHWT4=
github.com/rancher/lasso v0.0.0-20240828170735-d79536cac289/go.mod h1:Efx/+BbH3ivmnTPLu5cA3Gc9wT5oyGS0LBcqEuYTx+A=
github.com/rancher/wrangler v1.1.2 h1:oXbXo9k7y/H4drUpb4RM1c++vT9O3rpoNEfyusGykiU=
github.com/rancher/wrangler v1.1.2/go.mod h1:2k9MyhlBdjcutcBGoOJSUAz0HgDAXnMjv81d3n/AaQc=
github.com/rancher/wrangler/v3 v3.0.0 h1:IHHCA+vrghJDPxjtLk4fmeSCFhNe9fFzLFj3m2B0YpA=
github.com/rancher/wrangler/v3 v3.0.0/go.mod h1:Dfckuuq7MJk2JWVBDywRlZXMxEyPxHy4XqGrPEzu5Eg=
github.com/reugn/go-quartz v0.11.2 h1:+jc54Ji06n/D/endEPmc+CuG/Jc8466nda1oxtFRrks=
Expand Down
12 changes: 6 additions & 6 deletions integrationtests/gitjob/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"k8s.io/client-go/util/retry"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/rancher/wrangler/pkg/name"
"github.com/rancher/wrangler/v3/pkg/genericcondition"

"github.com/rancher/fleet/integrationtests/utils"
Expand Down Expand Up @@ -174,9 +173,10 @@ var _ = Describe("GitJob controller", func() {
g.Expect(checkCondition(&gitRepo, "Accepted", corev1.ConditionTrue, "")).To(BeTrue())
}).Should(Succeed())

// it should log 2 events
// it should log 3 events
// first one is to log the new commit from the poller
// second one is to inform that the job was created
// third one is to inform that the job was deleted because it succeeded
Eventually(func(g Gomega) {
events, _ := k8sClientSet.CoreV1().Events(gitRepo.Namespace).List(context.TODO(),
metav1.ListOptions{
Expand Down Expand Up @@ -393,7 +393,7 @@ var _ = Describe("GitJob controller", func() {
}).Should(Not(HaveOccurred()))
// wait until the job has finished
Eventually(func() bool {
jobName = name.SafeConcatName(gitRepoName, name.Hex(repo+commit, 5))
jobName = names.SafeConcatName(gitRepoName, names.Hex(repo+commit, 5))
err := k8sClient.Get(ctx, types.NamespacedName{Name: jobName, Namespace: gitRepoNamespace}, &job)
return errors.IsNotFound(err)
}).Should(BeTrue())
Expand All @@ -403,7 +403,7 @@ var _ = Describe("GitJob controller", func() {
Expect(simulateIncreaseForceSyncGeneration(gitRepo)).ToNot(HaveOccurred())
// simulate job was successful
Eventually(func() error {
jobName = name.SafeConcatName(gitRepoName, name.Hex(repo+commit, 5))
jobName = names.SafeConcatName(gitRepoName, names.Hex(repo+commit, 5))
err := k8sClient.Get(ctx, types.NamespacedName{Name: jobName, Namespace: gitRepoNamespace}, &job)
// We could be checking this when the job is still not created
Expect(client.IgnoreNotFound(err)).ToNot(HaveOccurred())
Expand All @@ -418,7 +418,7 @@ var _ = Describe("GitJob controller", func() {
}).Should(Not(HaveOccurred()))
// wait until the job has finished
Eventually(func() bool {
jobName = name.SafeConcatName(gitRepoName, name.Hex(repo+commit, 5))
jobName = names.SafeConcatName(gitRepoName, names.Hex(repo+commit, 5))
err := k8sClient.Get(ctx, types.NamespacedName{Name: jobName, Namespace: gitRepoNamespace}, &job)
return errors.IsNotFound(err)
}).Should(BeTrue())
Expand Down Expand Up @@ -508,7 +508,7 @@ var _ = Describe("GitJob controller", func() {
}).Should(Not(HaveOccurred()))
// wait until the job has finished
Eventually(func() bool {
jobName = name.SafeConcatName(gitRepoName, name.Hex(repo+commit, 5))
jobName = names.SafeConcatName(gitRepoName, names.Hex(repo+commit, 5))
err := k8sClient.Get(ctx, types.NamespacedName{Name: jobName, Namespace: gitRepoNamespace}, &job)
return errors.IsNotFound(err)
}).Should(BeTrue())
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/fleet.cattle.io/v1alpha1/gitrepo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ type GitRepoStatus struct {
// Commit is the Git commit hash from the last git job run.
// +nullable
Commit string `json:"commit,omitempty"`
// WebhookCommit is the Git commit hash from the last git commit received from a webhook
// WebhookCommit is the latest Git commit hash received from a webhook
// +nullable
WebhookCommit string `json:"webhookCommit,omitempty"`
// ReadyClusters is the lowest number of clusters that are ready over
Expand Down

0 comments on commit 453ceea

Please sign in to comment.