Skip to content

Commit

Permalink
fix: add custom empty status
Browse files Browse the repository at this point in the history
Signed-off-by: realanna <anna.reale@dynatrace.com>
  • Loading branch information
RealAnna committed Aug 1, 2023
1 parent 1c3c537 commit ed03513
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 12 deletions.
6 changes: 6 additions & 0 deletions metrics-operator/api/common/EmptyStatus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package common

// Empty status for configuration only CRDs
type EmptyStatus struct {

Check failure on line 5 in metrics-operator/api/common/EmptyStatus.go

View workflow job for this annotation

GitHub Actions / golangci-lint (metrics-operator, metrics-operator/)

File is not `gofmt`-ed with `-s` (gofmt)
}
3 changes: 2 additions & 1 deletion metrics-operator/api/v1alpha3/keptnmetricsprovider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha3

import (
"github.com/keptn/lifecycle-toolkit/metrics-operator/api/common"
"strings"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -48,7 +49,7 @@ type KeptnMetricsProvider struct {

Spec KeptnMetricsProviderSpec `json:"spec,omitempty"`
// unused field
Status metav1.Status `json:"status,omitempty"`
Status common.EmptyStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ func TestKeptnMetricsProvider_GetType(t *testing.T) {
TypeMeta metav1.TypeMeta
ObjectMeta metav1.ObjectMeta
Spec KeptnMetricsProviderSpec
Status metav1.Status
}
tests := []struct {
name string
Expand Down Expand Up @@ -52,7 +51,6 @@ func TestKeptnMetricsProvider_GetType(t *testing.T) {
TypeMeta: tt.fields.TypeMeta,
ObjectMeta: tt.fields.ObjectMeta,
Spec: tt.fields.Spec,
Status: tt.fields.Status,
}
if got := p.GetType(); got != tt.want {
t.Errorf("GetType() = %v, want %v", got, tt.want)
Expand All @@ -66,7 +64,6 @@ func TestKeptnMetricsProvider_HasSecretDefined(t *testing.T) {
TypeMeta metav1.TypeMeta
ObjectMeta metav1.ObjectMeta
Spec KeptnMetricsProviderSpec
Status metav1.Status
}
tests := []struct {
name string
Expand Down Expand Up @@ -136,7 +133,6 @@ func TestKeptnMetricsProvider_HasSecretDefined(t *testing.T) {
TypeMeta: tt.fields.TypeMeta,
ObjectMeta: tt.fields.ObjectMeta,
Spec: tt.fields.Spec,
Status: tt.fields.Status,
}
if got := p.HasSecretDefined(); got != tt.want {
t.Errorf("HasSecretDefined() = %v, want %v", got, tt.want)
Expand Down
6 changes: 6 additions & 0 deletions operator/apis/common/EmptyStatus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package common

// Empty status for configuration only CRDs
type EmptyStatus struct {

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
"github.com/keptn/lifecycle-toolkit/operator/apis/common"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -46,7 +47,7 @@ type KeptnEvaluationDefinition struct {

Spec KeptnEvaluationDefinitionSpec `json:"spec,omitempty"`
// unused field
Status metav1.Status `json:"status,omitempty"`
Status common.EmptyStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
"github.com/keptn/lifecycle-toolkit/operator/apis/common"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -40,7 +41,7 @@ type KeptnEvaluationProvider struct {

Spec KeptnEvaluationProviderSpec `json:"spec,omitempty"`
// unused field
Status metav1.Status `json:"status,omitempty"`
Status common.EmptyStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha2

import (
"github.com/keptn/lifecycle-toolkit/operator/apis/common"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -46,7 +47,7 @@ type KeptnEvaluationDefinition struct {

Spec KeptnEvaluationDefinitionSpec `json:"spec,omitempty"`
// unused field
Status metav1.Status `json:"status,omitempty"`
Status common.EmptyStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha2

import (
"github.com/keptn/lifecycle-toolkit/operator/apis/common"
"strings"

corev1 "k8s.io/api/core/v1"
Expand All @@ -43,7 +44,7 @@ type KeptnEvaluationProvider struct {

Spec KeptnEvaluationProviderSpec `json:"spec,omitempty"`
// unused field
Status metav1.Status `json:"status,omitempty"`
Status common.EmptyStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha3

import (
"github.com/keptn/lifecycle-toolkit/operator/apis/common"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -58,7 +59,7 @@ type KeptnEvaluationDefinition struct {
// Spec describes the desired state of the KeptnEvaluationDefinition.
Spec KeptnEvaluationDefinitionSpec `json:"spec,omitempty"`
// unused field
Status metav1.Status `json:"status,omitempty"`
Status common.EmptyStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha3

import (
"github.com/keptn/lifecycle-toolkit/operator/apis/common"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand All @@ -41,7 +42,7 @@ type KeptnEvaluationProvider struct {

Spec KeptnEvaluationProviderSpec `json:"spec,omitempty"`
// unused field
Status metav1.Status `json:"status,omitempty"`
Status common.EmptyStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
3 changes: 2 additions & 1 deletion operator/apis/options/v1alpha1/keptnconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
"github.com/keptn/lifecycle-toolkit/operator/apis/common"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -48,7 +49,7 @@ type KeptnConfig struct {

Spec KeptnConfigSpec `json:"spec,omitempty"`
// unused field
Status metav1.Status `json:"status,omitempty"`
Status common.EmptyStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down

0 comments on commit ed03513

Please sign in to comment.