Skip to content

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
this mainly upgrades github.com/ninech/apis and loki because of some
broken dependencies. The apis package is using the branch
up-dependencies until this makes it to main.
  • Loading branch information
ctrox committed Dec 22, 2023
1 parent 4ad6bea commit 113f8c9
Show file tree
Hide file tree
Showing 8 changed files with 1,390 additions and 373 deletions.
7 changes: 3 additions & 4 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/ninech/apis"
"github.com/ninech/nctl/api/log"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/rest"
Expand Down Expand Up @@ -56,12 +55,12 @@ func New(ctx context.Context, apiClusterContext, project string, opts ...ClientO
return nil, err
}

mapper := apis.StaticRESTMapper(scheme)
mapper.Add(corev1.SchemeGroupVersion.WithKind("Secret"), meta.RESTScopeNamespace)
// mapper := apis.StaticRESTMapper(scheme)
// mapper.Add(corev1.SchemeGroupVersion.WithKind("Secret"), meta.RESTScopeNamespace)

c, err := runtimeclient.NewWithWatch(client.Config, runtimeclient.Options{
Scheme: scheme,
Mapper: mapper,
// Mapper: mapper,
})
if err != nil {
return nil, err
Expand Down
3 changes: 3 additions & 0 deletions api/log/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"time"

"github.com/gorilla/websocket"
// "github.com/grafana/loki/pkg/logcli/volume"

"github.com/grafana/loki/pkg/loghttp"
legacy "github.com/grafana/loki/pkg/loghttp/legacy"
"github.com/grafana/loki/pkg/logproto"
Expand Down Expand Up @@ -76,6 +78,7 @@ func lokiTailHandler(t *testing.T, timestamp time.Time, lines []string) http.Han
}
}
}

func (f fake) QueryRange(queryStr string, limit int, start, end time.Time, direction logproto.Direction, step, interval time.Duration, quiet bool) (*loghttp.QueryResponse, error) {
entries := []loghttp.Entry{}
for v, line := range f.lines {
Expand Down
12 changes: 6 additions & 6 deletions create/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func TestApplicationWait(t *testing.T) {
app.Status.AtProvider.Hosts = []apps.VerificationStatus{{Name: "host.example.org"}}
app.Status.AtProvider.CNAMETarget = "some.target.example.org"
app.Status.AtProvider.BasicAuthSecret = &meta.LocalReference{Name: basicAuth.Name}
if err := apiClient.Status().Update(ctx, app); err != nil {
if err := apiClient.Update(ctx, app); err != nil {
errors <- err
}

Expand All @@ -428,12 +428,12 @@ func TestApplicationWait(t *testing.T) {
}

build.Status.AtProvider.BuildStatus = buildStatusRunning
if err := apiClient.Status().Update(ctx, build); err != nil {
if err := apiClient.Update(ctx, build); err != nil {
errors <- err
}

build.Status.AtProvider.BuildStatus = buildStatusSuccess
if err := apiClient.Status().Update(ctx, build); err != nil {
if err := apiClient.Update(ctx, build); err != nil {
errors <- err
}

Expand All @@ -442,7 +442,7 @@ func TestApplicationWait(t *testing.T) {
}

release.Status.AtProvider.ReleaseStatus = releaseStatusAvailable
if err := apiClient.Status().Update(ctx, release); err != nil {
if err := apiClient.Update(ctx, release); err != nil {
errors <- err
}
}
Expand Down Expand Up @@ -525,7 +525,7 @@ func TestApplicationBuildFail(t *testing.T) {
}

build.Status.AtProvider.BuildStatus = buildStatusError
if err := client.Status().Update(ctx, build); err != nil {
if err := client.Update(ctx, build); err != nil {
errors <- err
}
}
Expand Down Expand Up @@ -553,5 +553,5 @@ func setResourceCondition(ctx context.Context, apiClient *api.Client, mg resourc
}

mg.SetConditions(condition)
return apiClient.Status().Update(ctx, mg)
return apiClient.Update(ctx, mg)
}
2 changes: 2 additions & 0 deletions create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package create
import (
"context"
"fmt"
"log"
"math/rand"
"time"

Expand Down Expand Up @@ -159,6 +160,7 @@ func isWatchError(err error) bool {
func (w *waitStage) wait(ctx context.Context, client *api.Client) error {
_ = w.spinner.Start()

log.Printf("watching %T", w.objectList)
wa, err := client.Watch(ctx, w.objectList, w.listOpts...)
if err != nil {
return watchError{kind: w.kind}
Expand Down
2 changes: 1 addition & 1 deletion create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestCreate(t *testing.T) {
}

asa.SetConditions(runtimev1.Available())
if err := apiClient.Status().Update(ctx, asa); err != nil {
if err := apiClient.Update(ctx, asa); err != nil {
errChan <- err
}
}
Expand Down
2 changes: 1 addition & 1 deletion get/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dev
projects: test.Projects(organization, "dev", "staging"),
name: "dev",
outputFormat: yamlOut,
output: "kind: Project\napiVersion: management.nine.ch/v1alpha1\nmetadata:\n name: dev\n namespace: evilcorp\nspec: {}\n",
output: "kind: Project\napiVersion: management.nine.ch/v1alpha1\nmetadata:\n name: dev\n namespace: evilcorp\nspec:\n isNonProduction: false\n",
},
} {
t.Run(name, func(t *testing.T) {
Expand Down
Loading

0 comments on commit 113f8c9

Please sign in to comment.