Skip to content

Commit

Permalink
Merge pull request #435 from gianlucam76/helm-oci
Browse files Browse the repository at this point in the history
Helm charts: fix oci use case
  • Loading branch information
gianlucam76 authored Jan 23, 2024
2 parents 8dd6ee4 + b0a71b7 commit 7a7e439
Show file tree
Hide file tree
Showing 35 changed files with 910 additions and 2,513 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ deploy-projectsveltos: $(KUSTOMIZE)
@echo 'Install libsveltos CRDs'
$(KUBECTL) apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG)/config/crd/bases/lib.projectsveltos.io_debuggingconfigurations.yaml
$(KUBECTL) apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG)/config/crd/bases/lib.projectsveltos.io_sveltosclusters.yaml
$(KUBECTL) apply -f https://raw.githubusercontent.com/projectsveltos/libsveltos/$(TAG)/config/crd/bases/lib.projectsveltos.io_addoncompliances.yaml

# Install projectsveltos addon-controller components
@echo 'Install projectsveltos addon-controller components'
Expand All @@ -294,9 +293,6 @@ deploy-projectsveltos: $(KUSTOMIZE)
# Install sveltoscluster-manager
$(KUBECTL) apply -f https://raw.githubusercontent.com/projectsveltos/sveltoscluster-manager/$(TAG)/manifest/manifest.yaml

# Install addon-compliance-controller
$(KUBECTL) apply -f https://raw.githubusercontent.com/projectsveltos/addon-compliance-controller/$(TAG)/manifest/manifest.yaml

@echo "Waiting for projectsveltos addon-controller to be available..."
$(KUBECTL) wait --for=condition=Available deployment/addon-controller -n projectsveltos --timeout=$(TIMEOUT)

Expand Down
61 changes: 61 additions & 0 deletions api/v1alpha1/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"

libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
Expand Down Expand Up @@ -130,6 +131,62 @@ const (
HelmChartActionUninstall = HelmChartAction("Uninstall")
)

type HelmOptions struct {
// SkipCRDs controls whether CRDs should be installed during install/upgrade operation.
// By default, CRDs are installed if not already present.
// +kubebuilder:default:=false
// +optional
SkipCRDs bool `json:"skipCRDs,omitempty"`

// Create the release namespace if not present. Defaults to true
// +kubebuilder:default:=true
// +optional
CreateNamespace bool `json:"createNamespace,omitempty"`

// if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment, StatefulSet, or ReplicaSet
// are in a ready state before marking the release as successful. It will wait for as long as --timeout
// Default to false
// +kubebuilder:default:=false
// +optional
Wait bool `json:"wait,omitempty"`

// if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful.
// It will wait for as long as --timeout
// Default to false
// +kubebuilder:default:=false
// +optional
WaitForJobs bool `json:"waitForJobs,omitempty"`

// time to wait for any individual Kubernetes operation (like Jobs for hooks) (default 5m0s)
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

// prevent hooks from running during install
// Default to false
// +kubebuilder:default:=false
// +optional
DisableHooks bool `json:"disableHooks,omitempty"`

// if set, the installation process will not validate rendered templates against the Kubernetes OpenAPI Schema
// Default to false
// +kubebuilder:default:=false
// +optional
DisableOpenAPIValidation bool `json:"disableOpenAPIValidation,omitempty"`

// if set, the installation process deletes the installation on failure.
// The --wait flag will be set automatically if --atomic is used
// Default to false
// +kubebuilder:default:=false
// +optional
Atomic bool `json:"atomic,omitempty"`

// update dependencies if they are missing before installing the chart
// Default to false
// +kubebuilder:default:=false
// +optional
DependencyUpdate bool `json:"dependencyUpdate,omitempty"`
}

type HelmChart struct {
// RepositoryURL is the URL helm chart repository
// +kubebuilder:validation:MinLength=1
Expand Down Expand Up @@ -169,6 +226,10 @@ type HelmChart struct {
// +kubebuilder:default:=Install
// +optional
HelmChartAction HelmChartAction `json:"helmChartAction,omitempty"`

// Options allows to set flags which are used during installation.
// +optional
Options *HelmOptions `json:"options,omitempty"`
}

type KustomizationRef struct {
Expand Down
41 changes: 34 additions & 7 deletions api/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 0 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import (
configv1alpha1 "github.com/projectsveltos/addon-controller/api/v1alpha1"
"github.com/projectsveltos/addon-controller/api/v1alpha1/index"
"github.com/projectsveltos/addon-controller/controllers"
"github.com/projectsveltos/addon-controller/pkg/compliances"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -174,9 +173,6 @@ func main() {
profileReconciler, profileController,
clusterSummaryReconciler, clusterSummaryController)

go compliances.InitializeManager(ctx, ctrl.Log.WithName("addon-compliances"),
mgr.GetConfig(), mgr.GetClient(), addonComplianceTimer)

setupLog.Info("starting manager")
if err := mgr.Start(ctx); err != nil {
setupLog.Error(err, "problem running manager")
Expand Down
57 changes: 57 additions & 0 deletions config/crd/bases/config.projectsveltos.io_clusterprofiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,63 @@ spec:
- Install
- Uninstall
type: string
options:
description: Options allows to set flags which are used during
installation.
properties:
atomic:
default: false
description: if set, the installation process deletes the
installation on failure. The --wait flag will be set automatically
if --atomic is used Default to false
type: boolean
createNamespace:
default: true
description: Create the release namespace if not present.
Defaults to true
type: boolean
dependencyUpdate:
default: false
description: update dependencies if they are missing before
installing the chart Default to false
type: boolean
disableHooks:
default: false
description: prevent hooks from running during install Default
to false
type: boolean
disableOpenAPIValidation:
default: false
description: if set, the installation process will not validate
rendered templates against the Kubernetes OpenAPI Schema
Default to false
type: boolean
skipCRDs:
default: false
description: SkipCRDs controls whether CRDs should be installed
during install/upgrade operation. By default, CRDs are
installed if not already present.
type: boolean
timeout:
description: time to wait for any individual Kubernetes
operation (like Jobs for hooks) (default 5m0s)
type: string
wait:
default: false
description: if set, will wait until all Pods, PVCs, Services,
and minimum number of Pods of a Deployment, StatefulSet,
or ReplicaSet are in a ready state before marking the
release as successful. It will wait for as long as --timeout
Default to false
type: boolean
waitForJobs:
default: false
description: if set and --wait enabled, will wait until
all Jobs have been completed before marking the release
as successful. It will wait for as long as --timeout Default
to false
type: boolean
type: object
releaseName:
description: ReleaseName is the chart release
minLength: 1
Expand Down
58 changes: 58 additions & 0 deletions config/crd/bases/config.projectsveltos.io_clustersummaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,64 @@ spec:
- Install
- Uninstall
type: string
options:
description: Options allows to set flags which are used
during installation.
properties:
atomic:
default: false
description: if set, the installation process deletes
the installation on failure. The --wait flag will
be set automatically if --atomic is used Default to
false
type: boolean
createNamespace:
default: true
description: Create the release namespace if not present.
Defaults to true
type: boolean
dependencyUpdate:
default: false
description: update dependencies if they are missing
before installing the chart Default to false
type: boolean
disableHooks:
default: false
description: prevent hooks from running during install
Default to false
type: boolean
disableOpenAPIValidation:
default: false
description: if set, the installation process will not
validate rendered templates against the Kubernetes
OpenAPI Schema Default to false
type: boolean
skipCRDs:
default: false
description: SkipCRDs controls whether CRDs should be
installed during install/upgrade operation. By default,
CRDs are installed if not already present.
type: boolean
timeout:
description: time to wait for any individual Kubernetes
operation (like Jobs for hooks) (default 5m0s)
type: string
wait:
default: false
description: if set, will wait until all Pods, PVCs,
Services, and minimum number of Pods of a Deployment,
StatefulSet, or ReplicaSet are in a ready state before
marking the release as successful. It will wait for
as long as --timeout Default to false
type: boolean
waitForJobs:
default: false
description: if set and --wait enabled, will wait until
all Jobs have been completed before marking the release
as successful. It will wait for as long as --timeout
Default to false
type: boolean
type: object
releaseName:
description: ReleaseName is the chart release
minLength: 1
Expand Down
Loading

0 comments on commit 7a7e439

Please sign in to comment.