Skip to content

Commit

Permalink
chore: Add new secretref errors to status and rollback some api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TeodorSAP committed Oct 21, 2024
1 parent 0c850c1 commit cfdc945
Show file tree
Hide file tree
Showing 15 changed files with 9 additions and 92 deletions.
2 changes: 1 addition & 1 deletion apis/telemetry/v1alpha1/secret_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func getRefsInOtlpOutput(otlpOut *OtlpOutput) []SecretKeyRef {
}

func appendIfSecretRef(secretKeyRefs []SecretKeyRef, valueType ValueType) []SecretKeyRef {
if valueType.Value == "" && valueType.ValueFrom != nil && valueType.ValueFrom.IsSecretKeyRef() {
if valueType.Value == "" && valueType.ValueFrom != nil && valueType.ValueFrom.SecretKeyRef != nil {
secretKeyRefs = append(secretKeyRefs, *valueType.ValueFrom.SecretKeyRef)
}

Expand Down
3 changes: 1 addition & 2 deletions apis/telemetry/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ type ValueFromSource struct {
}

func (v *ValueFromSource) IsSecretKeyRef() bool {
return v.SecretKeyRef != nil
return v.SecretKeyRef != nil && v.SecretKeyRef.Name != "" && v.SecretKeyRef.Key != ""
}

type SecretKeyRef struct {
// The name of the Secret containing the referenced value
// +kubebuilder:validation:Required
Name string `json:"name,omitempty"`
// The name of the Namespace containing the Secret with the referenced value.
// +kubebuilder:validation:Required
Namespace string `json:"namespace,omitempty"`
// The name of the attribute of the Secret holding the referenced value.
// +kubebuilder:validation:Required
Expand Down
2 changes: 1 addition & 1 deletion apis/telemetry/v1beta1/secret_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func getRefsInOTLPOutput(out *OTLPOutput) []SecretKeyRef {
}

func appendIfSecretRef(secretKeyRefs []SecretKeyRef, valueType ValueType) []SecretKeyRef {
if valueType.Value == "" && valueType.ValueFrom != nil && valueType.ValueFrom.IsSecretKeyRef() {
if valueType.Value == "" && valueType.ValueFrom != nil && valueType.ValueFrom.SecretKeyRef != nil {
secretKeyRefs = append(secretKeyRefs, *valueType.ValueFrom.SecretKeyRef)
}

Expand Down
3 changes: 1 addition & 2 deletions apis/telemetry/v1beta1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ type ValueFromSource struct {
}

func (v *ValueFromSource) IsSecretKeyRef() bool {
return v.SecretKeyRef != nil
return v.SecretKeyRef != nil && v.SecretKeyRef.Name != "" && v.SecretKeyRef.Key != ""
}

type SecretKeyRef struct {
// The name of the Secret containing the referenced value
// +kubebuilder:validation:Required
Name string `json:"name,omitempty"`
// The name of the Namespace containing the Secret with the referenced value.
// +kubebuilder:validation:Required
Namespace string `json:"namespace,omitempty"`
// The name of the attribute of the Secret holding the referenced value.
// +kubebuilder:validation:Required
Expand Down
7 changes: 0 additions & 7 deletions config/crd/bases/telemetry.kyma-project.io_logpipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -200,7 +199,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -234,7 +232,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -262,7 +259,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -293,7 +289,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -331,7 +326,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -365,7 +359,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -358,7 +357,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -397,7 +395,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -440,7 +437,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
required:
Expand Down Expand Up @@ -496,7 +492,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -531,7 +526,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -574,7 +568,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -142,7 +141,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -181,7 +179,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -224,7 +221,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
required:
Expand Down Expand Up @@ -280,7 +276,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -315,7 +310,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down Expand Up @@ -358,7 +352,6 @@ spec:
required:
- key
- name
- namespace
type: object
type: object
type: object
Expand Down
Loading

0 comments on commit cfdc945

Please sign in to comment.