Skip to content

Commit

Permalink
local blob deployer (gardener#921)
Browse files Browse the repository at this point in the history
* replace ocm dependency with ocm master

* implement getResourceKeyGoFunc

* add resourceKey to helm deployItem api

* implement getChartFromResourceRef scaffold

* update go mod file (run-int-tests)

* update go and golangci version

* resolve deprecation warnings

* adjust validation to enable using new chart configuration
(run-int-tests)

* implement getChartFromResourceRef

* implement template function to return resource content (run-int-tests)

* implement spiff functions and tests (run-int-tests)

* enable cd:// path expressions for resource reference (run-int-tests)

* implement path expression for spiff and tests

* (run-int-tests)

* fix linter warnings (run-int-tests)

* convert resourceRef to string (run-int-tests)

* GetChart from resourceRef test

* upgrade ocm dependency (run-int-tests)
  • Loading branch information
fabianburth authored Jan 24, 2024
1 parent e2e40a0 commit 8ac4ffc
Show file tree
Hide file tree
Showing 3,280 changed files with 377,902 additions and 49,275 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions apis/.schemes/helm-v1alpha1-ProviderConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,10 @@
"ref": {
"description": "Ref defines the reference to a helm chart in a oci repository.",
"type": "string"
},
"resourceRef": {
"description": "ResourceKey defines a key that can be given to a corresponding API in order to fetch the content of the resource defined in the blueprint",
"type": "string"
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions apis/deployer/helm/types_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ type Chart struct {
// HelmChartRepo defines a reference to a chart in a helm chart repo.
// +optional
HelmChartRepo *HelmChartRepo `json:"helmChartRepo,omitempty"`
// ResourceKey defines a key that can be given to a corresponding API in order to fetch the content of the resource
// defined in the blueprint
// +optional
ResourceRef string `json:"resourceRef,omitempty"`
}

// HelmChartRepo defines a reference to a chart in a helm chart repo
Expand Down
8 changes: 8 additions & 0 deletions apis/deployer/helm/v1alpha1/types_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ type Chart struct {
// HelmChartRepo defines a reference to a chart in a helm chart repo.
// +optional
HelmChartRepo *HelmChartRepo `json:"helmChartRepo,omitempty"`
// ResourceKey defines a key that can be given to a corresponding API in order to fetch the content of the resource
// defined in the blueprint
// +optional
ResourceRef string `json:"resourceRef,omitempty"`
}

type ResourceRef struct {
Key string `json:"key,omitempty"`
}

// HelmChartRepo defines a reference to a chart in a helm chart repo
Expand Down
4 changes: 2 additions & 2 deletions apis/deployer/helm/v1alpha1/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func ValidateProviderConfiguration(config *helmv1alpha1.ProviderConfiguration) e
// ValidateChart validates the access methods for a chart
func ValidateChart(fldPath *field.Path, chart helmv1alpha1.Chart) field.ErrorList {
allErrs := field.ErrorList{}
if len(chart.Ref) == 0 && chart.Archive == nil && chart.FromResource == nil && chart.HelmChartRepo == nil {
subPath := fldPath.Child("ref", "archive", "fromResource", "helmChartRepo")
if len(chart.Ref) == 0 && chart.Archive == nil && chart.FromResource == nil && chart.HelmChartRepo == nil && chart.ResourceRef == "" {
subPath := fldPath.Child("ref", "archive", "fromResource", "helmChartRepo", "resourceRef")
err := field.Required(subPath, "must not be empty")
return append(allErrs, err)
}
Expand Down
2 changes: 2 additions & 0 deletions apis/deployer/helm/v1alpha1/zz_generated.conversion.go

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

16 changes: 16 additions & 0 deletions apis/deployer/helm/v1alpha1/zz_generated.deepcopy.go

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

26 changes: 26 additions & 0 deletions apis/openapi/openapi_generated.go

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

4 changes: 2 additions & 2 deletions cmd/landscaper-agent/app/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"os"
"time"

"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

flag "github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime/serializer"
Expand Down Expand Up @@ -71,7 +71,7 @@ func (o *options) Complete() error {
LeaderElection: false,
Port: 9443,
MetricsBindAddress: "0",
SyncPeriod: pointer.Duration(time.Hour * 24 * 1000),
SyncPeriod: ptr.To[time.Duration](time.Hour * 24 * 1000),
}

hostRestConfig, err := ctrl.GetConfig()
Expand Down
4 changes: 2 additions & 2 deletions cmd/landscaper-controller/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os"
"time"

"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

"github.com/mandelsoft/vfs/pkg/osfs"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -88,7 +88,7 @@ func (o *Options) run(ctx context.Context) error {
LeaderElection: false,
Port: 9443,
MetricsBindAddress: "0",
SyncPeriod: pointer.Duration(time.Hour * 24 * 1000),
SyncPeriod: ptr.To[time.Duration](time.Hour * 24 * 1000),
}

//TODO: investigate whether this is used with an uncached client
Expand Down
25 changes: 16 additions & 9 deletions cmd/target-sync-controller/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@ import (
"context"
"fmt"
"os"

"k8s.io/utils/ptr"

"github.com/gardener/landscaper/controller-utils/pkg/logging"

"k8s.io/client-go/tools/clientcmd"

lc "github.com/gardener/landscaper/controller-utils/pkg/logging/constants"

lsutils "github.com/gardener/landscaper/pkg/utils"

"time"

"github.com/gardener/landscaper/pkg/landscaper/controllers/targetsync"

"github.com/spf13/cobra"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/utils/pointer"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/manager"

lsconfig "github.com/gardener/landscaper/apis/config"
lsinstall "github.com/gardener/landscaper/apis/core/install"
"github.com/gardener/landscaper/controller-utils/pkg/logging"
lc "github.com/gardener/landscaper/controller-utils/pkg/logging/constants"
"github.com/gardener/landscaper/pkg/landscaper/controllers/targetsync"
"github.com/gardener/landscaper/pkg/landscaper/crdmanager"
lsutils "github.com/gardener/landscaper/pkg/utils"
"github.com/gardener/landscaper/pkg/version"
)

Expand Down Expand Up @@ -57,7 +64,7 @@ func (o *options) run(ctx context.Context) error {
LeaderElection: false,
Port: 9443,
MetricsBindAddress: "0",
SyncPeriod: pointer.Duration(time.Hour * 24 * 1000),
SyncPeriod: ptr.To[time.Duration](time.Hour * 24 * 1000),
}

data, err := os.ReadFile(o.landscaperKubeconfigPath)
Expand Down Expand Up @@ -105,8 +112,8 @@ func (o *options) run(ctx context.Context) error {
func (o *options) ensureCRDs(ctx context.Context, mgr manager.Manager) error {
ctx = logging.NewContext(ctx, logging.Wrap(ctrl.Log.WithName("crdManager")))
crdConfig := lsconfig.CrdManagementConfiguration{
DeployCustomResourceDefinitions: pointer.Bool(true),
ForceUpdate: pointer.Bool(true),
DeployCustomResourceDefinitions: ptr.To[bool](true),
ForceUpdate: ptr.To[bool](true),
}

lsConfig := lsconfig.LandscaperConfiguration{
Expand Down
22 changes: 11 additions & 11 deletions docs/api-reference/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ e.g. &ldquo;<a href="https://json-schema.org/draft/2019-09/schema&quot;">https:/
<code>localTypes</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.JSONSchemaDefinition">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.JSONSchemaDefinition
map[string]..JSONSchemaDefinition
</a>
</em>
</td>
Expand Down Expand Up @@ -1012,7 +1012,7 @@ InstallationImports
<code>importDataMappings</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.AnyJSON">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.AnyJSON
map[string]..AnyJSON
</a>
</em>
</td>
Expand Down Expand Up @@ -1043,7 +1043,7 @@ InstallationExports
<code>exportDataMappings</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.AnyJSON">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.AnyJSON
map[string]..AnyJSON
</a>
</em>
</td>
Expand Down Expand Up @@ -1180,7 +1180,7 @@ InstallationImports
<code>importDataMappings</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.AnyJSON">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.AnyJSON
map[string]..AnyJSON
</a>
</em>
</td>
Expand Down Expand Up @@ -1211,7 +1211,7 @@ InstallationExports
<code>exportDataMappings</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.AnyJSON">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.AnyJSON
map[string]..AnyJSON
</a>
</em>
</td>
Expand Down Expand Up @@ -2522,7 +2522,7 @@ Note that the type information is used to determine the secret key and the type
<code>configurations</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.AnyJSON">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.AnyJSON
map[string]..AnyJSON
</a>
</em>
</td>
Expand Down Expand Up @@ -2978,8 +2978,8 @@ Error
<td>
<code>lastErrors</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.*github.com/gardener/landscaper/apis/core/v1alpha1.Error">
[]*github.com/gardener/landscaper/apis/core/v1alpha1.Error
<a href="#landscaper.gardener.cloud/v1alpha1.*..Error">
[]*..Error
</a>
</em>
</td>
Expand Down Expand Up @@ -3375,7 +3375,7 @@ InstallationImports
<code>importDataMappings</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.AnyJSON">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.AnyJSON
map[string]..AnyJSON
</a>
</em>
</td>
Expand Down Expand Up @@ -4600,7 +4600,7 @@ InstallationImports
<code>importDataMappings</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.AnyJSON">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.AnyJSON
map[string]..AnyJSON
</a>
</em>
</td>
Expand Down Expand Up @@ -4631,7 +4631,7 @@ InstallationExports
<code>exportDataMappings</code></br>
<em>
<a href="#landscaper.gardener.cloud/v1alpha1.AnyJSON">
map[string]github.com/gardener/landscaper/apis/core/v1alpha1.AnyJSON
map[string]..AnyJSON
</a>
</em>
</td>
Expand Down
Loading

0 comments on commit 8ac4ffc

Please sign in to comment.