Skip to content

Commit

Permalink
adjust code to updated components
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Schrodi committed Aug 13, 2021
1 parent fffa86a commit 41063df
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 7 deletions.
2 changes: 2 additions & 0 deletions hack/generate-code
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ PROJECT_ROOT="${CURRENT_DIR}"/..

rm -f ${GOPATH}/bin/*-gen

chmod +x "${PROJECT_ROOT}"/vendor/k8s.io/code-generator/*.sh

echo "> Generating internal groups for TestMachinery"
"${PROJECT_ROOT}"/vendor/k8s.io/code-generator/generate-internal-groups.sh \
deep-copy,defaulter,conversion \
Expand Down
4 changes: 2 additions & 2 deletions pkg/hostscheduler/gkescheduler/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func restConfigFromCluster(cluster *containerpb.Cluster) (*rest.Config, error) {
CertData: cert,
KeyData: key,
},
Username: auth.GetUsername(),
Password: auth.GetPassword(),
Username: auth.GetUsername(), //nolint
Password: auth.GetPassword(), //nolint
}
return cfg, nil
}
Expand Down
13 changes: 10 additions & 3 deletions pkg/testrunner/componentdescriptor/componentdescriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"

"github.com/gardener/component-cli/ociclient"
ociopts "github.com/gardener/component-cli/ociclient/options"
comphelper "github.com/gardener/component-cli/pkg/components"
"github.com/gardener/component-cli/pkg/commands/constants"
cdcomponents "github.com/gardener/component-cli/pkg/components"
cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2"
"github.com/gardener/component-spec/bindings-go/codec"
"github.com/gardener/component-spec/bindings-go/ctf/ctfutils"
cdoci "github.com/gardener/component-spec/bindings-go/oci"
"github.com/go-logr/logr"
"github.com/mandelsoft/vfs/pkg/osfs"

Expand All @@ -42,8 +46,11 @@ func GetComponents(ctx context.Context, log logr.Logger, ociClient ociclient.Cli
if err := codec.Decode(content, compDesc, codec.DisableValidation(true)); err != nil {
return nil, err
}
resolver := comphelper.New(log, osfs.New(), ociClient, codec.DisableValidation(true))
compList, err := comphelper.ResolveTransitiveComponentDescriptors(ctx, resolver, compDesc)
resolver := cdoci.NewResolver(ociClient, codec.DisableValidation(true)).WithLog(log)
if len(os.Getenv(constants.ComponentRepositoryCacheDirEnvVar)) != 0 {
resolver.WithCache(cdcomponents.NewLocalComponentCache(osfs.New()))
}
compList, err := ctfutils.ResolveList(ctx, resolver, compDesc.GetEffectiveRepositoryContext(), compDesc.GetName(), compDesc.GetVersion())
if err != nil {
return nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ var _ = Describe("componentdescriptor test", func() {
It("Should parse a component descriptor and return 2 dependencies", func() {
input, err := ioutil.ReadFile("./testdata/component_descriptor_1")
Expect(err).ToNot(HaveOccurred(), "Cannot read json file from ./testdata/component_descriptor_1")
Expect(os.Setenv(constants.ComponentRepositoryCacheDirEnvVar, "./testdata")).To(Succeed())
defer os.Unsetenv(constants.ComponentRepositoryCacheDirEnvVar)

dependencies, err := GetComponents(ctx, log.NullLogger{}, mockOCIClient, input)
Expect(err).ToNot(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
meta:
schemaVersion: 'v2'

component:
name: 'github.com/gardener/gardener'
version: '0.17.0'

repositoryContexts:
- type: 'ociRegistry'
baseUrl: 'registry.example'
provider: 'internal'
sources: []
resources: []
componentReferences:
- name: 'dashboard'
componentName: 'github.com/gardener/dashboard'
version: '1.27.0'
6 changes: 5 additions & 1 deletion pkg/testrunner/template/template_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"path/filepath"
"testing"

"github.com/gardener/component-cli/pkg/commands/constants"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
Expand All @@ -28,6 +29,7 @@ var (
defaultTestdataDir string
shootTestdataDir string
gardenerKubeconfig string
componentCacheDir string
componentDescriptorPath string
)

Expand All @@ -41,10 +43,12 @@ var _ = BeforeSuite(func() {
Expect(err).ToNot(HaveOccurred())
testdataDir, err = filepath.Abs(filepath.Join(wd, "testdata"))
Expect(err).ToNot(HaveOccurred())
componentCacheDir = testdataDir

defaultTestdataDir = filepath.Join(testdataDir, "default")
shootTestdataDir = filepath.Join(testdataDir, "shoot")

gardenerKubeconfig = filepath.Join(testdataDir, "test-kubeconfig.yaml")
componentDescriptorPath = filepath.Join(testdataDir, "test-cd.yaml")
componentDescriptorPath = filepath.Join(componentCacheDir, "registry.example/github.com/gardener/gardener-0.30.0")
Expect(os.Setenv(constants.ComponentRepositoryCacheDirEnvVar, componentCacheDir))
})
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ component:
sources: []
resources: []
componentReferences: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified vendor/k8s.io/code-generator/generate-groups.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ github.com/gardener/component-spec/bindings-go/apis/v2/jsonscheme
github.com/gardener/component-spec/bindings-go/apis/v2/validation
github.com/gardener/component-spec/bindings-go/codec
github.com/gardener/component-spec/bindings-go/ctf
github.com/gardener/component-spec/bindings-go/ctf/ctfutils
github.com/gardener/component-spec/bindings-go/oci
github.com/gardener/component-spec/bindings-go/utils/selector
# github.com/gardener/external-dns-management v0.7.18
Expand Down

0 comments on commit 41063df

Please sign in to comment.