Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into runtime_node_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
shorim committed Sep 16, 2024
2 parents 26fdf8b + 64012a8 commit 9396305
Show file tree
Hide file tree
Showing 158 changed files with 4,430 additions and 2,937 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,3 @@ jobs:
payload-file-path: ".github/workflows/slack-message.json"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_HUSKIES_NOTIF_WEBHOOK_URL }}

Build-Image-Success:
needs: build-image
runs-on: ubuntu-latest
steps:
- name: List images
run: |
echo "${{ needs.build-image.outputs.images }}"
25 changes: 25 additions & 0 deletions .github/workflows/pr-allcheckspassed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: All Checks passed
on:
pull_request:
types:
[
opened,
synchronize,
reopened,
ready_for_review,
edited,
labeled,
milestoned,
]
jobs:
allchecks:
runs-on: ubuntu-latest
permissions:
checks: read
contents: read
steps:
- uses: wechuli/allcheckspassed@2e5e8bbc775f5680ed5d02e3a22e2fc7219792ac
with:
delay: '5'
retries: '30'
polling_interval: '1'
13 changes: 0 additions & 13 deletions .github/workflows/pr-code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
# This is a workaround to bypass the limitations of the workflow path filter:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
check-changed-files:
name: Check whether any source code files have been changed
outputs:
check: ${{ steps.changed-files.outputs.any_modified }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -98,15 +97,3 @@ jobs:
env:
PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PULL_HEAD_SHA: ${{ github.event.pull_request.head.sha }}

PR-Code-Checks-Success:
needs:
- unit-tests
- lint
- coverage
- gitleaks
runs-on: ubuntu-latest
steps:
- name: Success
run: |
echo "PR Code Checks completed successfully"
8 changes: 0 additions & 8 deletions .github/workflows/pr-docu-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,3 @@ jobs:
- name: Verify links
run: |
md-check-link -q -n 8 -c https://raw.githubusercontent.com/kyma-project/md-check-link/main/.mlc.config.json ./
PR-Docu-Checks-Success:
needs: [verify-manifests, markdown-link-check]
runs-on: ubuntu-latest
steps:
- name: Success
run: |
echo "PR Docu Checks completed successfully"
23 changes: 18 additions & 5 deletions .github/workflows/pr-github-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Validate title
uses: amannn/action-semantic-pull-request@47b15d52c5c30e94a17ec87eb8dd51ff5221fed9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
with:
types: |
deps
Expand All @@ -70,10 +70,23 @@ jobs:
requireScope: false
subjectPattern: ^([A-Z].*[^.]|bump .*)$

PR-Github-Checks-Success:
needs: [pr-milestone-check, pr-label-check, pr-title-check]
pr-prevent-kustomization:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.base.ref == 'main' }}
steps:
- name: PR Github Checks Success
- name: Check-out code
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check kustomization.yaml changes
uses: tj-actions/changed-files@6b2903bdce6310cfbddd87c418f253cf29b2dec9
id: changed-kustomization
with:
files: "config/manager/kustomization.yaml"
- name: Prevent kustomization.yaml changes
run: |
echo "PR Github Checks Success"
if ${{ steps.changed-kustomization.outputs.any_changed }}; then
echo "kustomization.yaml file changed!"
exit 1
fi
13 changes: 0 additions & 13 deletions .github/workflows/pr-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
# This is a workaround to bypass the limitations of the workflow path filter:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
check-changed-files:
name: Check whether any source code files have been changed
outputs:
check: ${{ steps.changed-files.outputs.any_modified }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -178,15 +177,3 @@ jobs:
with:
failure: failure()
job-name: ${{ github.job }}-${{ matrix.signal-type }}-${{ matrix.scenario }}

PR-Integration-Success:
needs:
- e2e
- e2e-dev
- e2e-istio
- e2e-self-mon
runs-on: ubuntu-latest
steps:
- name: Success
run: |
echo "PR Integration completed successfully"
17 changes: 4 additions & 13 deletions .github/workflows/pr-lifecycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
# This is a workaround to bypass the limitations of the workflow path filter:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
check-changed-files:
name: Check whether any source code files have been changed
outputs:
check: ${{ steps.changed-files.outputs.any_modified }}
runs-on: ubuntu-latest
Expand All @@ -34,7 +33,7 @@ jobs:
run: echo '${{ steps.changed-files.outputs.all_changed_files }}' >> $GITHUB_STEP_SUMMARY

manager-upgrade:
needs:
needs:
- check-changed-files
if: ${{ needs.check-changed-files.outputs.check == 'true' }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -70,13 +69,13 @@ jobs:
run: |
bin/ginkgo run --junit-report=junit-report-latest-version.xml --tags e2e --flake-attempts=5 --label-filter="operational" -v test/e2e
- name: Switch back to current revision
uses: actions/checkout@v4

- name: Wait for cleanup of test run
shell: bash
run: hack/wait-for-namespaces.sh

- name: Switch back to current revision
uses: actions/checkout@v4

# wait for the build to complete so that the manager image is available
- name: Wait for the Build Image workflow to complete
run: "./hack/await_workflow.sh"
Expand Down Expand Up @@ -105,11 +104,3 @@ jobs:
with:
failure: failure()
job-name: ${{ github.job }}

PR-Lifecycle-Success:
needs: manager-upgrade
runs-on: ubuntu-latest
steps:
- name: Success
run: |
echo "PR Lifecycle completed successfully"
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ linters:
# Depreacted linters
- gomnd
- execinquery
- exportloopref
# Linters to be enabled after fixing the issues
- intrange
- cyclop
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Contributing

## Overview

To contribute to this project, follow the general [contributing](https://github.com/kyma-project/community/blob/main/docs/contributing/02-contributing.md) guidelines.
To contribute to this project, follow the general [Contributing Rules](https://github.com/kyma-project/community/blob/main/docs/contributing/02-contributing.md).
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM europe-docker.pkg.dev/kyma-project/prod/external/library/golang:1.22.5-alpine as builder
FROM europe-docker.pkg.dev/kyma-project/prod/external/library/golang:1.22.5-alpine AS builder

WORKDIR /telemetry-manager-workspace
# Copy the Go Modules manifests
Expand Down
19 changes: 0 additions & 19 deletions apis/telemetry/v1alpha1/logpipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,6 @@ type Filter struct {
Custom string `json:"custom,omitempty"`
}

// LokiOutput configures an output to the Kyma-internal Loki instance.
type LokiOutput struct {
// Grafana Loki URL.
URL ValueType `json:"url,omitempty"`
// Labels to set for each log record.
Labels map[string]string `json:"labels,omitempty"`
// Attributes to be removed from a log record.
RemoveKeys []string `json:"removeKeys,omitempty"`
}

// HTTPOutput configures an HTTP-based output compatible with the Fluent Bit HTTP output plugin.
type HTTPOutput struct {
// Defines the host of the HTTP receiver.
Expand Down Expand Up @@ -133,8 +123,6 @@ type Output struct {
Custom string `json:"custom,omitempty"`
// Configures an HTTP-based output compatible with the Fluent Bit HTTP output plugin.
HTTP *HTTPOutput `json:"http,omitempty"`
// The grafana-loki output is not supported anymore. For integration with a custom Loki installation, use the `custom` output and follow [Installing a custom Loki stack in Kyma](https://kyma-project.io/#/telemetry-manager/user/integration/loki/README ).
Loki *LokiOutput `json:"grafana-loki,omitempty"`
}

func (i *Input) IsDefined() bool {
Expand All @@ -149,10 +137,6 @@ func (o *Output) IsHTTPDefined() bool {
return o.HTTP != nil && o.HTTP.Host.IsDefined()
}

func (o *Output) IsLokiDefined() bool {
return o.Loki != nil && o.Loki.URL.IsDefined()
}

func (o *Output) IsAnyDefined() bool {
return o.pluginCount() > 0
}
Expand All @@ -169,9 +153,6 @@ func (o *Output) pluginCount() int {
if o.IsHTTPDefined() {
plugins++
}
if o.IsLokiDefined() {
plugins++
}
return plugins
}

Expand Down
16 changes: 0 additions & 16 deletions apis/telemetry/v1alpha1/logpipeline_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,18 @@ func TestLogPipelineOutput(t *testing.T) {
expectedAny: true,
expectedSingle: true,
},
{
name: "loki",
given: Output{Loki: &LokiOutput{URL: ValueType{Value: "localhost"}}},
expectedLoki: true,
expectedAny: true,
expectedSingle: true,
},
{
name: "invalid: none defined",
given: Output{},
expectedAny: false,
expectedSingle: false,
},
{
name: "invalid: multiple defined",
given: Output{Custom: "name: null", Loki: &LokiOutput{URL: ValueType{Value: "localhost"}}},
expectedCustom: true,
expectedLoki: true,
expectedAny: true,
expectedSingle: false,
},
}

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
require.Equal(t, test.expectedCustom, test.given.IsCustomDefined())
require.Equal(t, test.expectedHTTP, test.given.IsHTTPDefined())
require.Equal(t, test.expectedLoki, test.given.IsLokiDefined())
require.Equal(t, test.expectedAny, test.given.IsAnyDefined())
})
}
Expand Down
36 changes: 0 additions & 36 deletions apis/telemetry/v1alpha1/logpipeline_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package v1alpha1

import (
"fmt"
"net/url"
"regexp"
"strings"

Expand Down Expand Up @@ -31,12 +30,6 @@ func (lp *LogPipeline) validateOutput(deniedOutputPlugins []string) error {
}
}

if output.IsLokiDefined() {
if err := validateLokiOutput(output.Loki); err != nil {
return err
}
}

return validateCustomOutput(deniedOutputPlugins, output.Custom)
}

Expand All @@ -50,20 +43,6 @@ func checkSingleOutputPlugin(output Output) error {
return nil
}

func validateLokiOutput(lokiOutput *LokiOutput) error {
if lokiOutput.URL.Value != "" && !validURL(lokiOutput.URL.Value) {
return fmt.Errorf("invalid hostname '%s'", lokiOutput.URL.Value)
}
if !lokiOutput.URL.IsDefined() && (len(lokiOutput.Labels) != 0 || len(lokiOutput.RemoveKeys) != 0) {
return fmt.Errorf("loki output must have a URL configured")
}
if secretRefAndValueIsPresent(lokiOutput.URL) {
return fmt.Errorf("loki output URL must have either a value or secret key reference")
}
return nil

}

func validateHTTPOutput(httpOutput *HTTPOutput) error {
isValidHostname, err := validHostname(httpOutput.Host.Value)

Expand All @@ -89,21 +68,6 @@ func validateHTTPOutput(httpOutput *HTTPOutput) error {
return nil
}

func validURL(host string) bool {
host = strings.Trim(host, " ")

_, err := url.ParseRequestURI(host)
if err != nil {
return false
}

u, err := url.Parse(host)
if err != nil || u.Scheme == "" || u.Host == "" {
return false
}
return true
}

func validHostname(host string) (bool, error) {
host = strings.Trim(host, " ")
re, err := regexp.Compile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$`)
Expand Down
4 changes: 0 additions & 4 deletions apis/telemetry/v1alpha1/secret_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ func (lp *LogPipeline) GetEnvSecretRefs() []SecretKeyRef {
refs = appendIfSecretRef(refs, output.HTTP.User)
refs = appendIfSecretRef(refs, output.HTTP.Password)
}
if output.IsLokiDefined() {
refs = appendIfSecretRef(refs, output.Loki.URL)
}

return refs
}

Expand Down
Loading

0 comments on commit 9396305

Please sign in to comment.