Skip to content

Commit

Permalink
Merge branch 'main' into create-ns-while-install
Browse files Browse the repository at this point in the history
  • Loading branch information
christophenne committed Sep 13, 2024
2 parents 700e081 + 8db61a6 commit 3530b0b
Show file tree
Hide file tree
Showing 67 changed files with 2,116 additions and 657 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.20.1"
".": "0.21.0"
}
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## [0.21.0](https://github.com/glasskube/glasskube/compare/v0.20.1...v0.21.0) (2024-09-11)


### Features

* **cli:** add `--use-default` flag for `install`, `update`, `configure` commands ([#1219](https://github.com/glasskube/glasskube/issues/1219)) ([8f24214](https://github.com/glasskube/glasskube/commit/8f24214aedd71c8fa41d198c2b36067ec8f33947))
* **package-operator:** add specifying values for package components ([#1218](https://github.com/glasskube/glasskube/issues/1218)) ([ff7c3ce](https://github.com/glasskube/glasskube/commit/ff7c3cefa541b59544be29a5e41ab96fc5d2cb67))
* **package-operator:** add support for resource transformations ([#1210](https://github.com/glasskube/glasskube/issues/1210)) ([5f934cb](https://github.com/glasskube/glasskube/commit/5f934cb5e47ad02438ad2c0d55b13a25d7708807))


### Bug Fixes

* **deps:** update dependency @getcanary/web to ^0.0.102 ([#1204](https://github.com/glasskube/glasskube/issues/1204)) ([511a66b](https://github.com/glasskube/glasskube/commit/511a66b738cd60ea0fff6752cfecb71ee41c8933))
* **deps:** update dependency @getcanary/web to ^0.0.104 ([#1217](https://github.com/glasskube/glasskube/issues/1217)) ([8c85ace](https://github.com/glasskube/glasskube/commit/8c85acecef1d618695c7c44d8c7cdfe04af0a2c0))
* **deps:** update fontsource monorepo ([#1202](https://github.com/glasskube/glasskube/issues/1202)) ([e281523](https://github.com/glasskube/glasskube/commit/e2815234da09f37ff0b5c31e3cabf68cdb22aae4))


### Other

* change transitiveResources type to TypeLocalObjectReference ([#1211](https://github.com/glasskube/glasskube/issues/1211)) ([54c78cd](https://github.com/glasskube/glasskube/commit/54c78cdb0ea5151a661104282d11a99bea15d496))
* **deps:** bump body-parser and express in /website ([#1222](https://github.com/glasskube/glasskube/issues/1222)) ([9c5416e](https://github.com/glasskube/glasskube/commit/9c5416edf2e1747134ba787a9bc2bba44696cc6e))
* **deps:** update commitlint monorepo to v19.5.0 ([#1221](https://github.com/glasskube/glasskube/issues/1221)) ([ede058b](https://github.com/glasskube/glasskube/commit/ede058b09172135a3f0bad8fd6bc73551087a55d))
* **deps:** update dependency typescript to ~5.6.0 ([#1214](https://github.com/glasskube/glasskube/issues/1214)) ([0e2ca5b](https://github.com/glasskube/glasskube/commit/0e2ca5b936c5f6d93a401efbfb1d16615bde8714))
* **deps:** update dependency typescript-eslint to v8.5.0 ([#1215](https://github.com/glasskube/glasskube/issues/1215)) ([f5ada7e](https://github.com/glasskube/glasskube/commit/f5ada7e90c9364983eb3f8f93177bb1e3516e1f8))


### Docs

* add package manifest reference ([#1212](https://github.com/glasskube/glasskube/issues/1212)) ([7ff01ce](https://github.com/glasskube/glasskube/commit/7ff01ce5d020bf2df8cd970b0bd2fc565d5a8fab))
* **website:** change the site banner ([#1206](https://github.com/glasskube/glasskube/issues/1206)) ([371474c](https://github.com/glasskube/glasskube/commit/371474cf3b58ed88d8a3de48bf5815f802989dff))
* **website:** improve Blog page Layout ([#1153](https://github.com/glasskube/glasskube/issues/1153)) ([70033d5](https://github.com/glasskube/glasskube/commit/70033d57a24612f2f70482ae793c3bee3e5eec3f))
* **website:** improve launch week wording ([#1213](https://github.com/glasskube/glasskube/issues/1213)) ([243798e](https://github.com/glasskube/glasskube/commit/243798e860785da5db4b80815e136e9bfab436b0))
* **website:** some spelling changes and new visual assets ([#1216](https://github.com/glasskube/glasskube/issues/1216)) ([dbfd2a9](https://github.com/glasskube/glasskube/commit/dbfd2a994e65cab74fc52e2c36ae364d54125677))

## [0.20.1](https://github.com/glasskube/glasskube/compare/v0.20.0...v0.20.1) (2024-09-06)


Expand Down
8 changes: 6 additions & 2 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ type ValueReference struct {
PackageRef *PackageValueSource `json:"packageRef,omitempty"`
}

type InlineValueConfiguration struct {
Value *string `json:"value,omitempty"`
}

// +kubebuilder:validation:MinProperties:=1
// +kubebuilder:validation:MaxProperties:=1
type ValueConfiguration struct {
Value *string `json:"value,omitempty"`
ValueFrom *ValueReference `json:"valueFrom,omitempty"`
InlineValueConfiguration `json:",inline"`
ValueFrom *ValueReference `json:"valueFrom,omitempty"`
}

// PackageSpec defines the desired state
Expand Down
34 changes: 26 additions & 8 deletions api/v1alpha1/package_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"strings"

"github.com/invopop/jsonschema"
corev1 "k8s.io/api/core/v1"
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type HelmManifest struct {
Expand Down Expand Up @@ -83,6 +83,18 @@ type Component struct {
Name string `json:"name" jsonschema:"required"`
InstalledName string `json:"installedName,omitempty"`
Version string `json:"version,omitempty"`
// Specify configuration for this component
Values ComponentValues `json:"values,omitempty"`
}

type ComponentValues map[string]InlineValueConfiguration

func (values ComponentValues) AsPackageValues() map[string]ValueConfiguration {
result := make(map[string]ValueConfiguration, len(values))
for name, value := range values {
result[name] = ValueConfiguration{InlineValueConfiguration: value}
}
return result
}

// +kubebuilder:validation:Enum=Cluster;Namespaced
Expand Down Expand Up @@ -110,9 +122,14 @@ func (s *PackageScope) IsNamespaced() bool {
return s != nil && *s == ScopeNamespaced
}

type TransitiveResource struct {
metav1.GroupVersionKind `json:",inline"`
Name string `json:"name" jsonschema:"required"`
type TransformationSource struct {
Resource *corev1.TypedLocalObjectReference `json:"resource,omitempty"`
Path string `json:"path" jsonschema:"required"`
}

type TransformationDefinition struct {
Source TransformationSource `json:"source" jsonschema:"required"`
Targets []ValueDefinitionTarget `json:"targets" jsonschema:"required"`
}

type PackageManifest struct {
Expand All @@ -126,10 +143,11 @@ type PackageManifest struct {
// Helm instructs the controller to create a helm release when installing this package.
Helm *HelmManifest `json:"helm,omitempty"`
// Kustomize instructs the controller to apply a kustomization when installing this package [PLACEHOLDER].
Kustomize *KustomizeManifest `json:"kustomize,omitempty"`
Manifests []PlainManifest `json:"manifests,omitempty"`
ValueDefinitions map[string]ValueDefinition `json:"valueDefinitions,omitempty"`
TransitiveResources []TransitiveResource `json:"transitiveResources,omitempty"`
Kustomize *KustomizeManifest `json:"kustomize,omitempty"`
Manifests []PlainManifest `json:"manifests,omitempty"`
ValueDefinitions map[string]ValueDefinition `json:"valueDefinitions,omitempty"`
Transformations []TransformationDefinition `json:"transformations,omitempty"`
TransitiveResources []corev1.TypedLocalObjectReference `json:"transitiveResources,omitempty"`
// DefaultNamespace to install the package. May be overridden.
DefaultNamespace string `json:"defaultNamespace,omitempty" jsonschema:"required"`
Entrypoints []PackageEntrypoint `json:"entrypoints,omitempty"`
Expand Down
108 changes: 95 additions & 13 deletions api/v1alpha1/zz_generated.deepcopy.go

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

7 changes: 6 additions & 1 deletion cmd/glasskube/cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

var configureCmdOptions = struct {
flags.ValuesOptions
flags.UseDefaultOptions
OutputOptions
NamespaceOptions
KindOptions
Expand Down Expand Up @@ -72,7 +73,10 @@ func runConfigure(cmd *cobra.Command, args []string) {
} else if len(pkgManifest.ValueDefinitions) == 0 {
fmt.Fprintln(os.Stderr, "❌ this package has no configuration values")
cliutils.ExitWithError()
} else if values, err := cli.Configure(*pkgManifest, pkg.GetSpec().Values); err != nil {
} else if values, err := cli.Configure(*pkgManifest,
cli.WithOldValues(pkg.GetSpec().Values),
cli.WithUseDefaults(configureCmdOptions.UseDefault),
); err != nil {
fmt.Fprintf(os.Stderr, "❌ error during configure: %v\n", err)
cliutils.ExitWithError()
} else {
Expand Down Expand Up @@ -141,6 +145,7 @@ func runConfigure(cmd *cobra.Command, args []string) {

func init() {
configureCmdOptions.ValuesOptions.AddFlagsToCommand(configureCmd)
configureCmdOptions.UseDefaultOptions.AddFlagsToCommand(configureCmd)
configureCmdOptions.OutputOptions.AddFlagsToCommand(configureCmd)
configureCmdOptions.NamespaceOptions.AddFlagsToCommand(configureCmd)
configureCmdOptions.KindOptions.AddFlagsToCommand(configureCmd)
Expand Down
4 changes: 3 additions & 1 deletion cmd/glasskube/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (

var installCmdOptions = struct {
flags.ValuesOptions
flags.UseDefaultOptions
Version string
Repository string
EnableAutoUpdates bool
Expand Down Expand Up @@ -181,7 +182,7 @@ var installCmd = &cobra.Command{
pkgBuilder.WithValues(values)
}
} else {
if values, err := cli.Configure(manifest, nil); err != nil {
if values, err := cli.Configure(manifest, cli.WithUseDefaults(installCmdOptions.UseDefault)); err != nil {
cancel()
} else {
pkgBuilder.WithValues(values)
Expand Down Expand Up @@ -370,6 +371,7 @@ func init() {
installCmd.PersistentFlags().BoolVar(&installCmdOptions.NoWait, "no-wait", false, "Perform non-blocking install")
installCmd.PersistentFlags().BoolVarP(&installCmdOptions.Yes, "yes", "y", false, "Do not ask for any confirmation")
installCmdOptions.ValuesOptions.AddFlagsToCommand(installCmd)
installCmdOptions.UseDefaultOptions.AddFlagsToCommand(installCmd)
installCmdOptions.OutputOptions.AddFlagsToCommand(installCmd)
installCmdOptions.NamespaceOptions.AddFlagsToCommand(installCmd)
installCmdOptions.DryRunOptions.AddFlagsToCommand(installCmd)
Expand Down
9 changes: 7 additions & 2 deletions cmd/glasskube/cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/glasskube/glasskube/internal/controller/ctrlpkg"
"github.com/glasskube/glasskube/internal/manifestvalues/cli"
"github.com/glasskube/glasskube/internal/manifestvalues/flags"

"github.com/glasskube/glasskube/api/v1alpha1"
"github.com/glasskube/glasskube/internal/clicontext"
Expand All @@ -30,6 +31,7 @@ import (
)

var updateCmdOptions struct {
flags.UseDefaultOptions
Version string
Yes bool
DryRunOptions
Expand Down Expand Up @@ -255,8 +257,10 @@ func updateConfigurationIfNeeded(ctx context.Context, pkg ctrlpkg.Package, newVe

if len(newManifest.ValueDefinitions) > 0 {
if cliutils.YesNoPrompt(fmt.Sprintf("Do you want to update the configuration for %s?", pkg.GetName()), false) {

values, err := cli.Configure(*newManifest, pkg.GetSpec().Values)
values, err := cli.Configure(*newManifest,
cli.WithOldValues(pkg.GetSpec().Values),
cli.WithUseDefaults(updateCmdOptions.UseDefault),
)
if err != nil {
return fmt.Errorf("error during configuration: %v", err)
}
Expand All @@ -276,6 +280,7 @@ func init() {
updateCmdOptions.OutputOptions.AddFlagsToCommand(updateCmd)
updateCmdOptions.KindOptions.AddFlagsToCommand(updateCmd)
updateCmdOptions.NamespaceOptions.AddFlagsToCommand(updateCmd)
updateCmdOptions.UseDefaultOptions.AddFlagsToCommand(updateCmd)
RootCmd.AddCommand(updateCmd)
updateCmdOptions.DryRunOptions.AddFlagsToCommand(updateCmd)
}
2 changes: 1 addition & 1 deletion config/autoupdater/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ commonLabels:
app.kubernetes.io/name: glasskube-autoupdate
images:
- name: ghcr.io/glasskube/glasskube
newTag: v0.20.1 # x-release-please-version
newTag: v0.21.0 # x-release-please-version
Loading

0 comments on commit 3530b0b

Please sign in to comment.