Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lifecycle-operator)!: move API HUB version to v1beta1 #2772

Merged
merged 15 commits into from
Jan 10, 2024
2 changes: 1 addition & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ kwv
lastmod
lastword
Lato
lfc
LFC
Lifcycle
lifecyclekeptnsh
linkedin
Expand Down
26 changes: 2 additions & 24 deletions .github/scripts/.helm-tests/default/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2685,16 +2685,6 @@ metadata:
app.kubernetes.io/version: vmyversion
helm.sh/chart: lifecycle-operator-0.1.0
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /convert
conversionReviewVersions:
- v1
group: lifecycle.keptn.sh
names:
kind: KeptnEvaluationProvider
Expand Down Expand Up @@ -7170,16 +7160,6 @@ metadata:
app.kubernetes.io/version: vmyversion
helm.sh/chart: lifecycle-operator-0.1.0
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /convert
conversionReviewVersions:
- v1
group: lifecycle.keptn.sh
names:
kind: KeptnWorkloadInstance
Expand Down Expand Up @@ -11953,8 +11933,6 @@ spec:
value: "0"
- name: KEPTN_WORKLOAD_VERSION_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_WORKLOAD_INSTANCE_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_DORA_METRICS_PORT
value: "2222"
- name: OPTIONS_CONTROLLER_LOG_LEVEL
Expand Down Expand Up @@ -12321,14 +12299,14 @@ webhooks:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /validate-lifecycle-keptn-sh-v1alpha3-keptntaskdefinition
path: /validate-lifecycle-keptn-sh-v1beta1-keptntaskdefinition
failurePolicy: Fail
name: vkeptntaskdefinition.kb.io
rules:
- apiGroups:
- lifecycle.keptn.sh
apiVersions:
- v1alpha3
- v1beta1
operations:
- CREATE
- UPDATE
Expand Down
26 changes: 2 additions & 24 deletions .github/scripts/.helm-tests/lifecycle-only/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2631,16 +2631,6 @@ metadata:
app.kubernetes.io/version: vmyversion
helm.sh/chart: lifecycle-operator-0.1.0
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /convert
conversionReviewVersions:
- v1
group: lifecycle.keptn.sh
names:
kind: KeptnEvaluationProvider
Expand Down Expand Up @@ -7116,16 +7106,6 @@ metadata:
app.kubernetes.io/version: vmyversion
helm.sh/chart: lifecycle-operator-0.1.0
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /convert
conversionReviewVersions:
- v1
group: lifecycle.keptn.sh
names:
kind: KeptnWorkloadInstance
Expand Down Expand Up @@ -9440,8 +9420,6 @@ spec:
value: "0"
- name: KEPTN_WORKLOAD_VERSION_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_WORKLOAD_INSTANCE_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_DORA_METRICS_PORT
value: "2222"
- name: OPTIONS_CONTROLLER_LOG_LEVEL
Expand Down Expand Up @@ -9649,14 +9627,14 @@ webhooks:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /validate-lifecycle-keptn-sh-v1alpha3-keptntaskdefinition
path: /validate-lifecycle-keptn-sh-v1beta1-keptntaskdefinition
failurePolicy: Fail
name: vkeptntaskdefinition.kb.io
rules:
- apiGroups:
- lifecycle.keptn.sh
apiVersions:
- v1alpha3
- v1beta1
operations:
- CREATE
- UPDATE
Expand Down
26 changes: 2 additions & 24 deletions .github/scripts/.helm-tests/lifecycle-with-certs/result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2663,16 +2663,6 @@ metadata:
app.kubernetes.io/version: vmyversion
helm.sh/chart: lifecycle-operator-0.1.0
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /convert
conversionReviewVersions:
- v1
group: lifecycle.keptn.sh
names:
kind: KeptnEvaluationProvider
Expand Down Expand Up @@ -7152,16 +7142,6 @@ metadata:
app.kubernetes.io/version: vmyversion
helm.sh/chart: lifecycle-operator-0.1.0
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /convert
conversionReviewVersions:
- v1
group: lifecycle.keptn.sh
names:
kind: KeptnWorkloadInstance
Expand Down Expand Up @@ -9756,8 +9736,6 @@ spec:
value: "0"
- name: KEPTN_WORKLOAD_VERSION_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_WORKLOAD_INSTANCE_CONTROLLER_LOG_LEVEL
value: "0"
- name: KEPTN_DORA_METRICS_PORT
value: "2222"
- name: OPTIONS_CONTROLLER_LOG_LEVEL
Expand Down Expand Up @@ -9968,14 +9946,14 @@ webhooks:
service:
name: 'lifecycle-webhook-service'
namespace: 'helmtests'
path: /validate-lifecycle-keptn-sh-v1alpha3-keptntaskdefinition
path: /validate-lifecycle-keptn-sh-v1beta1-keptntaskdefinition
failurePolicy: Fail
name: vkeptntaskdefinition.kb.io
rules:
- apiGroups:
- lifecycle.keptn.sh
apiVersions:
- v1alpha3
- v1beta1
operations:
- CREATE
- UPDATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ _Appears in:_
| `preDeploymentEvaluations` _string array_ | PreDeploymentEvaluations is a list of all evaluations to be performed during the pre-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `postDeploymentEvaluations` _string array_ | PostDeploymentEvaluations is a list of all evaluations to be performed during the post-deployment phase of the KeptnApp. The items of this list refer to the names of KeptnEvaluationDefinitions located in the same namespace as the KeptnApp, or in the Keptn namespace. || x |
| `metadata` _object (keys:string, values:string)_ | Refer to Kubernetes API documentation for fields of `metadata`. || ✓ |
| `traceLinks` _string array_ | TraceLinks are links to trace IDs for tracking. || ✓ |
| `traceLinks` _string array_ | TraceLinks are links to OpenTelemetry span IDs for tracking. These links establish relationships between spans across different services, enabling distributed tracing. For more information on OpenTelemetry span links, refer to the documentation: https://opentelemetry.io/docs/concepts/signals/traces/#span-links || ✓ |


#### KeptnAppContextStatus
Expand All @@ -263,6 +263,9 @@ KeptnAppContextStatus defines the observed state of KeptnAppContext
_Appears in:_
- [KeptnAppContext](#keptnappcontext)

| Field | Description | Default | Optional |
| --- | --- | --- | --- |
| `status` _string_ | unused field || ✓ |


#### KeptnAppCreationRequest
Expand Down
8 changes: 4 additions & 4 deletions lifecycle-operator/apis/lifecycle/v1alpha1/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ const MaxWorkloadNameLength = 25
const MaxTaskNameLength = 25
const MaxVersionLength = 12

var ErrCannotCastKeptnEvaluationProvider = errors.New("cannot cast KeptnEvaluationDefinition to v1alpha3")
var ErrCannotCastKeptnAppVersion = errors.New("cannot cast KeptnAppVersion to v1alpha3")
var ErrCannotCastKeptnApp = errors.New("cannot cast KeptnApp to v1alpha3")
var ErrCannotCastKeptnWorkloadInstance = errors.New("cannot cast KeptnWorkloadInstance to v1alpha3")
var ErrCannotCastKeptnEvaluationProvider = errors.New("cannot cast KeptnEvaluationDefinition to v1beta1")
var ErrCannotCastKeptnAppVersion = errors.New("cannot cast KeptnAppVersion to v1beta1")
var ErrCannotCastKeptnApp = errors.New("cannot cast KeptnApp to v1beta1")
var ErrCannotCastKeptnWorkloadInstance = errors.New("cannot cast KeptnWorkloadInstance to v1beta1")

// KeptnState is a string containing current Phase state (Progressing/Succeeded/Failed/Unknown/Pending/Cancelled)
type KeptnState string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"fmt"

"github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common"
"github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3"
"github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// ConvertTo converts the src v1alpha1.KeptnApp to the hub version (v1alpha3.KeptnApp)
// ConvertTo converts the src v1alpha1.KeptnApp to the hub version (v1beta1.KeptnApp)
func (src *KeptnApp) ConvertTo(dstRaw conversion.Hub) error {
dst, ok := dstRaw.(*v1alpha3.KeptnApp)
dst, ok := dstRaw.(*v1beta1.KeptnApp)

if !ok {
return fmt.Errorf("type %T %w", dstRaw, common.ErrCannotCastKeptnApp)
Expand All @@ -22,7 +22,7 @@ func (src *KeptnApp) ConvertTo(dstRaw conversion.Hub) error {

dst.Spec.Version = src.Spec.Version
for _, srcWl := range src.Spec.Workloads {
dst.Spec.Workloads = append(dst.Spec.Workloads, v1alpha3.KeptnWorkloadRef{
dst.Spec.Workloads = append(dst.Spec.Workloads, v1beta1.KeptnWorkloadRef{
Name: srcWl.Name,
Version: srcWl.Version,
})
Expand All @@ -40,9 +40,9 @@ func (src *KeptnApp) ConvertTo(dstRaw conversion.Hub) error {
return nil
}

// ConvertFrom converts from the hub version (v1alpha3.KeptnApp) to this version (v1alpha1.KeptnApp)
// ConvertFrom converts from the hub version (v1beta1.KeptnApp) to this version (v1alpha1.KeptnApp)
func (dst *KeptnApp) ConvertFrom(srcRaw conversion.Hub) error {
src, ok := srcRaw.(*v1alpha3.KeptnApp)
src, ok := srcRaw.(*v1beta1.KeptnApp)

if !ok {
return fmt.Errorf("type %T %w", srcRaw, common.ErrCannotCastKeptnApp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha1/common"
"github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1alpha3"
"github.com/keptn/lifecycle-toolkit/lifecycle-operator/apis/lifecycle/v1beta1"
"github.com/stretchr/testify/require"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v2 "sigs.k8s.io/controller-runtime/pkg/webhook/conversion/testdata/api/v2"
Expand All @@ -13,16 +13,16 @@ import (
func TestKeptnApp_ConvertFrom(t *testing.T) {
tests := []struct {
name string
srcObj *v1alpha3.KeptnApp
srcObj *v1beta1.KeptnApp
wantErr bool
wantObj *KeptnApp
}{
{
name: "Test that conversion from v1alpha3 to v1alpha1 works",
srcObj: &v1alpha3.KeptnApp{
name: "Test that conversion from v1beta1 to v1alpha1 works",
srcObj: &v1beta1.KeptnApp{
TypeMeta: v1.TypeMeta{
Kind: "KeptnApp",
APIVersion: "lifecycle.keptn.sh/v1alpha3",
APIVersion: "lifecycle.keptn.sh/v1beta1",
},
ObjectMeta: v1.ObjectMeta{
Name: "some-keptn-app-name",
Expand All @@ -34,10 +34,10 @@ func TestKeptnApp_ConvertFrom(t *testing.T) {
"some-annotation": "some-annotation-value",
},
},
Spec: v1alpha3.KeptnAppSpec{
Spec: v1beta1.KeptnAppSpec{
Version: "1.2.3",
Revision: 1,
Workloads: []v1alpha3.KeptnWorkloadRef{
Workloads: []v1beta1.KeptnWorkloadRef{
{
Name: "workload-1",
Version: "1.2.3",
Expand All @@ -60,7 +60,7 @@ func TestKeptnApp_ConvertFrom(t *testing.T) {
"some-pre-evaluation-task2",
},
},
Status: v1alpha3.KeptnAppStatus{
Status: v1beta1.KeptnAppStatus{
CurrentVersion: "1.2.3",
},
},
Expand Down Expand Up @@ -130,10 +130,10 @@ func TestKeptnApp_ConvertTo(t *testing.T) {
name string
src *KeptnApp
wantErr bool
wantObj *v1alpha3.KeptnApp
wantObj *v1beta1.KeptnApp
}{
{
name: "Test that conversion from v1alpha1 to v1alpha3 works",
name: "Test that conversion from v1alpha1 to v1beta1 works",
src: &KeptnApp{
TypeMeta: v1.TypeMeta{
Kind: "KeptnApp",
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestKeptnApp_ConvertTo(t *testing.T) {
},
},
wantErr: false,
wantObj: &v1alpha3.KeptnApp{
wantObj: &v1beta1.KeptnApp{
ObjectMeta: v1.ObjectMeta{
Name: "some-keptn-app-name",
Namespace: "",
Expand All @@ -190,10 +190,10 @@ func TestKeptnApp_ConvertTo(t *testing.T) {
"some-annotation": "some-annotation-value",
},
},
Spec: v1alpha3.KeptnAppSpec{
Spec: v1beta1.KeptnAppSpec{
Version: "1.2.3",
Revision: 1,
Workloads: []v1alpha3.KeptnWorkloadRef{
Workloads: []v1beta1.KeptnWorkloadRef{
{
Name: "workload-1",
Version: "1.2.3",
Expand All @@ -216,19 +216,19 @@ func TestKeptnApp_ConvertTo(t *testing.T) {
"some-pre-evaluation-task2",
},
},
Status: v1alpha3.KeptnAppStatus{
Status: v1beta1.KeptnAppStatus{
CurrentVersion: "1.2.3",
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
dst := v1alpha3.KeptnApp{
dst := v1beta1.KeptnApp{
TypeMeta: v1.TypeMeta{},
ObjectMeta: v1.ObjectMeta{},
Spec: v1alpha3.KeptnAppSpec{},
Status: v1alpha3.KeptnAppStatus{},
Spec: v1beta1.KeptnAppSpec{},
Status: v1beta1.KeptnAppStatus{},
}
if err := tt.src.ConvertTo(&dst); (err != nil) != tt.wantErr {
t.Errorf("ConvertTo() error = %v, wantErr %v", err, tt.wantErr)
Expand Down
Loading
Loading