From 43cf3818cde1391ff49d331d6abab7b322cd06e9 Mon Sep 17 00:00:00 2001 From: sadath-12 Date: Thu, 28 Dec 2023 00:53:31 +0530 Subject: [PATCH] dev test Signed-off-by: sadath-12 --- .github/workflows/validate-crd.yaml | 23 +++++++++++++++++++++++ pkg/policyfilter/state.go | 3 ++- todo.txt | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/validate-crd.yaml create mode 100644 todo.txt diff --git a/.github/workflows/validate-crd.yaml b/.github/workflows/validate-crd.yaml new file mode 100644 index 00000000000..ac4fe1cbf31 --- /dev/null +++ b/.github/workflows/validate-crd.yaml @@ -0,0 +1,23 @@ +name: Check CRD Version Update +on: + pull_request: + paths: + - 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/*.yaml' +jobs: + check-version: + runs-on: ubuntu-22.04 + steps: + - name: Check for CRD changes and version update + run: | + if git diff --name-only HEAD^ | grep -q 'pkg/k8s/apis/cilium.io/client/crds/v1alpha1/'; then + old_version=$(grep 'CustomResourceDefinitionSchemaVersion' pkg/k8s/apis/cilium.io/v1alpha1/register.go | awk -F'"' '{print $2}') + + new_version=$(grep 'CustomResourceDefinitionSchemaVersion' pkg/k8s/apis/cilium.io/v1alpha1/register.go | awk -F'"' '{print $2}') + + if [ "$old_version" == "$new_version" ]; then + echo "Error: CRD version not updated! Please update the CustomResourceDefinitionSchemaVersion in register.go" + exit 1 + fi + else + echo "No changes in the CRD files" + fi diff --git a/pkg/policyfilter/state.go b/pkg/policyfilter/state.go index 38df984dc81..f5938775c85 100644 --- a/pkg/policyfilter/state.go +++ b/pkg/policyfilter/state.go @@ -198,7 +198,7 @@ type policy struct { // polMap is the (inner) policy map for this policy polMap polMap -} +} func (pol *policy) podMatches(podNs string, podLabels labels.Labels) bool { if pol.namespace != "" && podNs != pol.namespace { @@ -386,6 +386,7 @@ func (m *state) AddPolicy(polID PolicyID, namespace string, podLabelSelector *sl } podSelector, err := labels.SelectorFromLabelSelector(podLabelSelector) + // https://github.com/cilium/tetragon/issues/1854 you extract the namespace from here and add into policy if err != nil { return err } diff --git a/todo.txt b/todo.txt new file mode 100644 index 00000000000..7a4fe52186b --- /dev/null +++ b/todo.txt @@ -0,0 +1,2 @@ +pick which is the main folders +where is the kubernetes operator