Skip to content

Commit

Permalink
Integrate Helm Controller Structs into the AppGroup Spec (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed May 19, 2021
1 parent 429d372 commit 683fc3f
Show file tree
Hide file tree
Showing 6 changed files with 319 additions and 531 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ deploy: manifests
# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=chart/orkestra/crds

# Run go fmt against code
fmt:
Expand Down
60 changes: 6 additions & 54 deletions api/v1alpha1/appgroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/Azure/Orkestra/pkg/meta"
fluxhelmv2beta1 "github.com/fluxcd/helm-controller/api/v2beta1"
corev1 "k8s.io/api/core/v1"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -67,40 +68,19 @@ type Release struct {

// Install holds the configuration for Helm install actions for this HelmRelease.
// +optional
Install *ReleaseInstallSpec `json:"install,omitempty"`
Install *fluxhelmv2beta1.Install `json:"install,omitempty"`

// Upgrade holds the configuration for Helm upgrade actions for this HelmRelease.
// +optional
Upgrade *ReleaseUpgradeSpec `json:"upgrade,omitempty"`
Upgrade *fluxhelmv2beta1.Upgrade `json:"upgrade,omitempty"`

// Rollback holds the configuration for Helm rollback actions for this HelmRelease.
// +optional
Rollback *ReleaseRollbackSpec `json:"rollback,omitempty"`
}

type ReleaseInstallSpec struct {
// DisableWait disables the waiting for resources to be ready after a Helm
// install has been performed.
// +optional
DisableWait bool `json:"disableWait,omitempty"`
}

type ReleaseUpgradeSpec struct {
// DisableWait disables the waiting for resources to be ready after a Helm
// upgrade has been performed.
// +optional
DisableWait bool `json:"disableWait,omitempty"`
Rollback *fluxhelmv2beta1.Rollback `json:"rollback,omitempty"`

// Force forces resource updates through a replacement strategy.
// Rollback holds the configuration for Helm uninstall actions for this HelmRelease.
// +optional
Force bool `json:"force,omitempty"`
}

type ReleaseRollbackSpec struct {
// DisableWait disables the waiting for resources to be ready after a Helm
// rollback has been performed.
// +optional
DisableWait bool `json:"disableWait,omitempty"`
Uninstall *fluxhelmv2beta1.Uninstall `json:"uninstall,omitempty"`
}

type ChartRef struct {
Expand Down Expand Up @@ -357,31 +337,3 @@ type ApplicationGroupList struct {
func init() {
SchemeBuilder.Register(&ApplicationGroup{}, &ApplicationGroupList{})
}

func (a *Release) DisableWaitForInstall() bool {
if a != nil && a.Install != nil {
return a.Install.DisableWait
}
return false
}

func (a *Release) DisableWaitForUpgrade() bool {
if a != nil && a.Upgrade != nil {
return a.Upgrade.DisableWait
}
return false
}

func (a *Release) DisableWaitForRollback() bool {
if a != nil && a.Rollback != nil {
return a.Rollback.DisableWait
}
return false
}

func (a *Release) ForceForUpgrade() bool {
if a != nil && a.Upgrade != nil {
return a.Upgrade.Force
}
return false
}
63 changes: 12 additions & 51 deletions api/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit 683fc3f

Please sign in to comment.