Skip to content

Commit

Permalink
fix:update crd version in helm chart (#19)
Browse files Browse the repository at this point in the history
* fix:update crd version in helm chart

* fix:update crd version in folder

* refactor: remove the import aliases as they are not needed thereby reducing maintenance with every upgrade

* refactor: upgrading the version on samples and comments that were missed in the last commit

Co-authored-by: Sangeetha Madamanchi <[email protected]>
  • Loading branch information
sangdammad and Sangeetha Madamanchi authored Sep 26, 2022
1 parent 4121100 commit f8aeafd
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 34 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ helmManifests: manifests kustomize kubernetes-split-yaml ## Create Helm Template
$(KUSTOMIZE) build config/helm-manifest >> charts/tmp.yaml
go run scripts/helm-charts/update.go
$(KUBERNETES_SPLIT_YAML) --outdir charts/overwhelm/templates charts/tmp.yaml
mv charts/overwhelm/templates/*-crd.yaml charts/overwhelm/crds
rm charts/tmp.yaml

.PHONY: helmInstall
Expand Down
4 changes: 2 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ resources:
domain: expediagroup.com
group: core
kind: Application
path: github.com/ExpediaGroup/overwhelm/api/v1alpha1
version: v1alpha1
path: github.com/ExpediaGroup/overwhelm/api/v1alpha2
version: v1alpha2
version: "3"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1
package v1alpha2

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package v1alpha1 contains API Schema definitions for the core v1alpha1 API group
// Package v1alpha2contains API Schema definitions for the core v1alpha2 API group
//+kubebuilder:object:generate=true
//+groupName=core.expediagroup.com
package v1alpha1
//+versionName:=v1alpha2
package v1alpha2

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -24,7 +25,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "core.expediagroup.com", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "core.expediagroup.com", Version: "v1alpha2"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package v1alpha1
package v1alpha2

// SourceReference is the reference of the source where the chart is available.
// For e.g., the HelmRepository resource specifying where the helm chart is located
Expand Down

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

2 changes: 1 addition & 1 deletion charts/overwhelm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: overwhelm
version: 1.1.0
version: 1.1.1
maintainers:
- name: "Expedia Group"
url: "https://github.com/ExpediaGroup/overwhelm"
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1alpha2
schema:
openAPIV3Schema:
description: Application is the Schema for the applications API
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/core.expediagroup.com_applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha1
name: v1alpha2
schema:
openAPIV3Schema:
description: Application is the Schema for the applications API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a sample of the Application Resource that, when deployed in a cluster, triggers the
# overwhelm operator to perform its reconciliation logic
apiVersion: core.expediagroup.com/v1alpha1
apiVersion: core.expediagroup.com/v1alpha2
kind: Application
metadata:
name: application-sample
Expand Down
2 changes: 1 addition & 1 deletion config/samples/full-example-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
interval: 5m0s
url: https://stefanprodan.github.io/podinfo
---
apiVersion: core.expediagroup.com/v1alpha1
apiVersion: core.expediagroup.com/v1alpha2
kind: Application
metadata:
name: podinfo
Expand Down
2 changes: 1 addition & 1 deletion config/samples/hr_app-sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: application-sample
namespace: app-namespace
ownerReferences:
- apiVersion: core.expediagroup.com/v1alpha1
- apiVersion: core.expediagroup.com/v1alpha2
blockOwnerDeletion: true
controller: true
kind: Application
Expand Down
2 changes: 1 addition & 1 deletion config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Append samples you want in your CSV to this file as resources ##
resources:
- core_v1alpha1_application.yaml
- core_v1alpha2_application.yaml
#+kubebuilder:scaffold:manifestskustomizesamples
2 changes: 1 addition & 1 deletion controllers/application_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
ctrllog "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/source"

v1 "github.com/ExpediaGroup/overwhelm/api/v1alpha1"
v1 "github.com/ExpediaGroup/overwhelm/api/v1alpha2"
)

// ApplicationReconciler reconciles an Application object
Expand Down
28 changes: 14 additions & 14 deletions controllers/application_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/ExpediaGroup/overwhelm/api/v1alpha1"
"github.com/ExpediaGroup/overwhelm/api/v1alpha2"
"github.com/fluxcd/helm-controller/api/v2beta1"
"github.com/fluxcd/pkg/apis/meta"
. "github.com/onsi/ginkgo"
Expand All @@ -21,9 +21,9 @@ import (

var ctx context.Context

var application = &v1alpha1.Application{
var application = &v1alpha2.Application{
TypeMeta: metav1.TypeMeta{
APIVersion: "core.expediagroup.com/v1alpha1",
APIVersion: "core.expediagroup.com/v1alpha2",
Kind: "Application",
},
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -32,9 +32,9 @@ var application = &v1alpha1.Application{
"test-my-label": "ok",
},
},
Spec: v1alpha1.ApplicationSpec{
Template: v1alpha1.ReleaseTemplate{
Metadata: v1alpha1.Metadata{
Spec: v1alpha2.ApplicationSpec{
Template: v1alpha2.ReleaseTemplate{
Metadata: v1alpha2.Metadata{
Labels: map[string]string{"test-temp-label": "ok"},
},
Spec: v2beta1.HelmReleaseSpec{
Expand Down Expand Up @@ -252,9 +252,9 @@ var _ = Describe("Application controller", func() {
}}
hr.SetConditions(conditions)
Expect(k8sClient.Status().Update(ctx, hr)).Should(BeNil())
app := &v1alpha1.Application{}
app := &v1alpha2.Application{}
Eventually(
func(ctx context.Context, key client.ObjectKey, app *v1alpha1.Application) func() error {
func(ctx context.Context, key client.ObjectKey, app *v1alpha2.Application) func() error {
return func() error {
if err := k8sClient.Get(ctx, key, app); err != nil {
return err
Expand Down Expand Up @@ -290,9 +290,9 @@ var _ = Describe("Application controller", func() {
}}
hr.SetConditions(conditions)
Expect(k8sClient.Status().Update(ctx, hr)).Should(BeNil())
app := &v1alpha1.Application{}
app := &v1alpha2.Application{}
Eventually(
func(ctx context.Context, app *v1alpha1.Application) func() error {
func(ctx context.Context, app *v1alpha2.Application) func() error {
return func() error {
if err := k8sClient.Get(ctx, client.ObjectKey{Name: a.Name, Namespace: a.Namespace}, app); err != nil {
return err
Expand Down Expand Up @@ -375,7 +375,7 @@ var _ = Describe("Application controller", func() {
}
}(ctx, p), 5*time.Second, 300*time.Millisecond).Should(BeNil())
Eventually(
func(ctx context.Context, app *v1alpha1.Application) func() error {
func(ctx context.Context, app *v1alpha2.Application) func() error {
return func() error {
if err := k8sClient.Get(ctx, client.ObjectKey{Name: a.Name, Namespace: a.Namespace}, app); err != nil {
return err
Expand All @@ -395,7 +395,7 @@ var _ = Describe("Application controller", func() {
By("Creating a new ConfigMap and rendering it with custom delimiter", func() {
b := application.DeepCopy()
b.Name = "b-app"
b.Spec.PreRenderer = v1alpha1.PreRenderer{
b.Spec.PreRenderer = v1alpha2.PreRenderer{
LeftDelimiter: "<%",
RightDelimiter: "%>",
EnableHelmTemplating: true,
Expand All @@ -422,7 +422,7 @@ var _ = Describe("Application controller", func() {
a := application.DeepCopy()
a.Name = "a-app"
key := client.ObjectKey{Name: a.Name, Namespace: a.Namespace}
currentApp := &v1alpha1.Application{}
currentApp := &v1alpha2.Application{}
Expect(k8sClient.Get(ctx, key, currentApp)).Should(BeNil())
a.ResourceVersion = currentApp.ResourceVersion
a.Spec.Template.Spec.Interval = metav1.Duration{Duration: time.Millisecond * 500}
Expand Down Expand Up @@ -478,7 +478,7 @@ var _ = Describe("Application controller", func() {
By("having missing custom rendering keys in values", func() {
d := application.DeepCopy()
d.Name = "d-app"
d.Spec.PreRenderer = v1alpha1.PreRenderer{
d.Spec.PreRenderer = v1alpha2.PreRenderer{
LeftDelimiter: "<%",
RightDelimiter: "%>",
EnableHelmTemplating: true,
Expand Down
4 changes: 2 additions & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"
"time"

corev1alpha1 "github.com/ExpediaGroup/overwhelm/api/v1alpha1"
"github.com/ExpediaGroup/overwhelm/api/v1alpha2"
"github.com/fluxcd/helm-controller/api/v2beta1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -71,7 +71,7 @@ var _ = BeforeSuite(func() {

err = v2beta1.AddToScheme(k8sManager.GetScheme())
Expect(err).NotTo(HaveOccurred())
err = corev1alpha1.AddToScheme(k8sManager.GetScheme())
err = v1alpha2.AddToScheme(k8sManager.GetScheme())
Expect(err).NotTo(HaveOccurred())

//+kubebuilder:scaffold:scheme
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"os"
"time"

corev1alpha1 "github.com/ExpediaGroup/overwhelm/api/v1alpha1"
"github.com/ExpediaGroup/overwhelm/api/v1alpha2"
"github.com/ExpediaGroup/overwhelm/controllers"
"github.com/fluxcd/helm-controller/api/v2beta1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -42,7 +42,7 @@ func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(v2beta1.AddToScheme(scheme))
utilruntime.Must(corev1alpha1.AddToScheme(scheme))
utilruntime.Must(v1alpha2.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

Expand Down

0 comments on commit f8aeafd

Please sign in to comment.