Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
withlin authored Dec 1, 2024
2 parents 42b1029 + c8c335d commit 87c4782
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ COPY pkg/ pkg/
# Build
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build $GO_BUILD_FLAGS -o /usr/local/bin/manager

FROM builder as debug
FROM builder AS debug

RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go install github.com/go-delve/delve/cmd/dlv@latest

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2679,8 +2679,6 @@ spec:
type: object
type: array
type: object
required:
- workloadMetaOverrides
type: object
status:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2676,8 +2676,6 @@ spec:
type: object
type: array
type: object
required:
- workloadMetaOverrides
type: object
status:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2676,8 +2676,6 @@ spec:
type: object
type: array
type: object
required:
- workloadMetaOverrides
type: object
status:
type: object
Expand Down
4 changes: 1 addition & 3 deletions pkg/sdk/extensions/api/v1alpha1/eventtailer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ type _metaEventTailer = interface{} //nolint:deadcode,unused

// EventTailerSpec defines the desired state of EventTailer
type EventTailerSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

//+kubebuilder:validation:Required

// The resources of EventTailer will be placed into this namespace
ControlNamespace string `json:"controlNamespace"`
// Volume definition for tracking fluentbit file positions (optional)
Expand Down
1 change: 0 additions & 1 deletion pkg/sdk/extensions/api/v1alpha1/hosttailer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type HostTailerSpec struct {
// daemonset (and possibly other resource in the future) in case there is a change in an immutable field
// that otherwise couldn't be managed with a simple update.
EnableRecreateWorkloadOnImmutableFieldChange bool `json:"enableRecreateWorkloadOnImmutableFieldChange,omitempty"`
//+kubebuilder:validation:Required
// Override metadata of the created resources
WorkloadMetaBase *types.MetaBase `json:"workloadMetaOverrides,omitempty"`
// Override podSpec fields for the given daemonset
Expand Down
11 changes: 11 additions & 0 deletions pkg/sdk/logging/model/syslogng/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ type Input struct {
SourcePort int
}

type outputInfo struct {
ref types.NamespacedName
}

type clusterOutputInfo struct {
ref types.NamespacedName
protected bool
Expand Down Expand Up @@ -99,7 +103,11 @@ func configRenderer(in Input) (render.Renderer, error) {
}
destinationDefs = append(destinationDefs, renderClusterOutput(co, in.SecretLoaderFactory))
}
outputRefs := make(map[string]outputInfo, len(in.Outputs))
for _, o := range in.Outputs {
outputRefs[o.Name] = outputInfo{
ref: types.NamespacedName{Namespace: o.Namespace, Name: o.Name},
}
destinationDefs = append(destinationDefs, renderOutput(o, in.SecretLoaderFactory))
}

Expand All @@ -114,6 +122,9 @@ func configRenderer(in Input) (render.Renderer, error) {
if err := validateClusterOutputs(clusterOutputRefs, client.ObjectKeyFromObject(&f).String(), f.Spec.GlobalOutputRefs, f.Kind); err != nil {
errs = errors.Append(errs, err)
}
if err := validateOutputs(outputRefs, client.ObjectKeyFromObject(&f).String(), f.Spec.LocalOutputRefs); err != nil {
errs = errors.Append(errs, err)
}
logDefs = append(logDefs, renderFlow(in.Name, clusterOutputRefs, sourceName, keyDelim(in.SyslogNGSpec.JSONKeyDelimiter), f, in.SecretLoaderFactory))
}

Expand Down
9 changes: 9 additions & 0 deletions pkg/sdk/logging/model/syslogng/config/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ const (
syslogNGFlowKind = "SyslogNGFlow"
)

func validateOutputs(outputRefs map[string]outputInfo, flow string, localOutputRefs []string) error {
return seqs.SeededReduce(seqs.FromSlice(localOutputRefs), nil, func(err error, ref string) error {
if _, ok := outputRefs[ref]; !ok {
return errors.Append(err, errors.Errorf("output reference %s for flow %s cannot be found", ref, flow))
}
return err
})
}

func validateClusterOutputs(clusterOutputRefs map[string]clusterOutputInfo, flow string, globalOutputRefs []string, flowKind string) error {
return seqs.SeededReduce(seqs.FromSlice(globalOutputRefs), nil, func(err error, ref string) error {
if _, ok := clusterOutputRefs[ref]; !ok {
Expand Down

0 comments on commit 87c4782

Please sign in to comment.