Skip to content

Commit

Permalink
Update flux 2.3.0
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps committed Jun 17, 2024
1 parent e466f74 commit b9a8168
Show file tree
Hide file tree
Showing 19 changed files with 509 additions and 516 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type NamespacedResourceWatcherCacheConfig struct {
OnResyncFunc ResyncFunc

// These funcs are needed to manipulate API-specific objects, such as flux's
// sourcev1beta2.HelmRepository, in a generic fashion
// sourcev1.HelmRepository, in a generic fashion
NewObjFunc NewObjectFunc
NewListFunc NewObjectListFunc
ListItemsFunc GetListItemsFunc
Expand Down
6 changes: 3 additions & 3 deletions cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"strings"

"github.com/bufbuild/connect-go"
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/cache"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/common"
Expand All @@ -27,12 +27,12 @@ import (
"sigs.k8s.io/yaml"
)

func (s *Server) getChartInCluster(ctx context.Context, headers http.Header, key types.NamespacedName) (*sourcev1beta2.HelmChart, error) {
func (s *Server) getChartInCluster(ctx context.Context, headers http.Header, key types.NamespacedName) (*sourcev1.HelmChart, error) {
client, err := s.getClient(headers, key.Namespace)
if err != nil {
return nil, err
}
var chartObj sourcev1beta2.HelmChart
var chartObj sourcev1.HelmChart
if err = client.Get(ctx, key, &chartObj); err != nil {
return nil, connecterror.FromK8sError("get", "HelmChart", key.String(), err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"testing"
"time"

sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
fluxplugin "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/plugins/fluxv2/packages/v1alpha1"
Expand Down Expand Up @@ -329,12 +329,12 @@ func TestKindClusterRepoAndChartRBAC(t *testing.T) {
rules := map[string][]rbacv1.PolicyRule{
names[1].Namespace: {
{
APIGroups: []string{sourcev1beta2.GroupVersion.Group},
APIGroups: []string{sourcev1.GroupVersion.Group},
Resources: []string{fluxHelmRepositories},
Verbs: []string{"get", "list"},
},
{
APIGroups: []string{sourcev1beta2.GroupVersion.Group},
APIGroups: []string{sourcev1.GroupVersion.Group},
Resources: []string{"helmcharts"},
Verbs: []string{"get", "list"},
},
Expand Down
24 changes: 12 additions & 12 deletions cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/bufbuild/connect-go"
fluxmeta "github.com/fluxcd/pkg/apis/meta"
sourcev1 "github.com/fluxcd/source-controller/api/v1"

Check failure on line 18 in cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go

View workflow job for this annotation

GitHub Actions / CI / test_go

other declaration of sourcev1

Check failure on line 18 in cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go

View workflow job for this annotation

GitHub Actions / CI / linters / golang-linter

other declaration of sourcev1
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
sourcev1 "github.com/fluxcd/source-controller/api/v1"

Check failure on line 19 in cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go

View workflow job for this annotation

GitHub Actions / CI / test_go

sourcev1 redeclared in this block

Check failure on line 19 in cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/chart_test.go

View workflow job for this annotation

GitHub Actions / CI / linters / golang-linter

sourcev1 redeclared in this block
"github.com/go-redis/redismock/v8"
corev1 "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/packages/v1alpha1"
"github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/plugins/fluxv2/packages/v1alpha1/cache"
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestGetAvailablePackageDetail(t *testing.T) {
}
defer ts2.Close()

s, mock, err := newServerWithRepos(t, []sourcev1beta2.HelmRepository{*repo}, charts, secretObjs)
s, mock, err := newServerWithRepos(t, []sourcev1.HelmRepository{*repo}, charts, secretObjs)
if err != nil {
t.Fatalf("%+v", err)
}
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestTransientHttpFailuresAreRetriedForChartCache(t *testing.T) {
}
defer ts2.Close()

s, mock, err := newServerWithRepos(t, []sourcev1beta2.HelmRepository{*repo}, charts, nil)
s, mock, err := newServerWithRepos(t, []sourcev1.HelmRepository{*repo}, charts, nil)
if err != nil {
t.Fatalf("%+v", err)
}
Expand Down Expand Up @@ -468,7 +468,7 @@ func TestNonExistingRepoOrInvalidPkgVersionGetAvailablePackageDetail(t *testing.
}
defer ts2.Close()

s, mock, err := newServerWithRepos(t, []sourcev1beta2.HelmRepository{*repo}, charts, nil)
s, mock, err := newServerWithRepos(t, []sourcev1.HelmRepository{*repo}, charts, nil)
if err != nil {
t.Fatalf("%+v", err)
}
Expand Down Expand Up @@ -649,7 +649,7 @@ func TestGetAvailablePackageVersions(t *testing.T) {
}
defer ts.Close()

s, mock, err := newServerWithRepos(t, []sourcev1beta2.HelmRepository{*repo}, charts, nil)
s, mock, err := newServerWithRepos(t, []sourcev1.HelmRepository{*repo}, charts, nil)
if err != nil {
t.Fatalf("%+v", err)
}
Expand Down Expand Up @@ -736,7 +736,7 @@ func TestGetOciAvailablePackageVersions(t *testing.T) {
t.Fatal(err)
}

s, mock, err := newServerWithRepos(t, []sourcev1beta2.HelmRepository{*repo}, tc.charts, nil)
s, mock, err := newServerWithRepos(t, []sourcev1.HelmRepository{*repo}, tc.charts, nil)
if err != nil {
t.Fatalf("%+v", err)
}
Expand Down Expand Up @@ -979,12 +979,12 @@ func TestChartWithRelativeURL(t *testing.T) {
}
}))

repoSpec := &sourcev1beta2.HelmRepositorySpec{
repoSpec := &sourcev1.HelmRepositorySpec{
URL: ts.URL,
Interval: metav1.Duration{Duration: 1 * time.Minute},
}

repoStatus := &sourcev1beta2.HelmRepositoryStatus{
repoStatus := &sourcev1.HelmRepositoryStatus{
Artifact: &sourcev1.Artifact{
Digest: "651f952130ea96823711d08345b85e82be011dc6",
LastUpdateTime: metav1.Time{Time: lastUpdateTime},
Expand All @@ -1003,7 +1003,7 @@ func TestChartWithRelativeURL(t *testing.T) {
defer ts.Close()

s, mock, err := newServerWithRepos(t,
[]sourcev1beta2.HelmRepository{repo},
[]sourcev1.HelmRepository{repo},
[]testSpecChartWithUrl{
{
chartID: fmt.Sprintf("%s/airflow", repoName),
Expand Down Expand Up @@ -1073,7 +1073,7 @@ func TestGetOciAvailablePackageDetail(t *testing.T) {
t.Fatal(err)
}

s, mock, err := newServerWithRepos(t, []sourcev1beta2.HelmRepository{*repo}, tc.charts, nil)
s, mock, err := newServerWithRepos(t, []sourcev1.HelmRepository{*repo}, tc.charts, nil)
if err != nil {
t.Fatalf("%+v", err)
}
Expand Down Expand Up @@ -1129,8 +1129,8 @@ func TestGetOciAvailablePackageDetail(t *testing.T) {
}
}

func newChart(name, namespace string, spec *sourcev1beta2.HelmChartSpec, status *sourcev1beta2.HelmChartStatus) sourcev1beta2.HelmChart {
helmChart := sourcev1beta2.HelmChart{
func newChart(name, namespace string, spec *sourcev1.HelmChartSpec, status *sourcev1.HelmChartStatus) sourcev1.HelmChart {
helmChart := sourcev1.HelmChart{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Generation: int64(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/bufbuild/connect-go"
"github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/credentials"
helmv2beta2 "github.com/fluxcd/helm-controller/api/v2beta2"
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
helmv2 "github.com/fluxcd/helm-controller/api/v2"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/go-redis/redis/v8"
"github.com/google/go-containerregistry/pkg/authn"
plugins "github.com/vmware-tanzu/kubeapps/cmd/kubeapps-apis/gen/core/plugins/v1alpha1"
Expand Down Expand Up @@ -68,20 +68,20 @@ func init() {
}

repositoriesGvr = schema.GroupVersionResource{
Group: sourcev1beta2.GroupVersion.Group,
Version: sourcev1beta2.GroupVersion.Version,
Group: sourcev1.GroupVersion.Group,
Version: sourcev1.GroupVersion.Version,
Resource: "helmrepositories",
}

chartsGvr = schema.GroupVersionResource{
Group: sourcev1beta2.GroupVersion.Group,
Version: sourcev1beta2.GroupVersion.Version,
Group: sourcev1.GroupVersion.Group,
Version: sourcev1.GroupVersion.Version,
Resource: "helmcharts",
}

releasesGvr = schema.GroupVersionResource{
Group: helmv2beta2.GroupVersion.Group,
Version: helmv2beta2.GroupVersion.Version,
Group: helmv2.GroupVersion.Group,
Version: helmv2.GroupVersion.Version,
Resource: "helmreleases",
}
}
Expand Down
Loading

0 comments on commit b9a8168

Please sign in to comment.