From 566aff336f7a599ce6674c9c2fc3369e7c6da89c Mon Sep 17 00:00:00 2001 From: Roman Bednar Date: Fri, 28 Jun 2024 13:48:51 +0200 Subject: [PATCH] UPSTREAM: : Add OpenShift files Additional changes: - remove .github files - do not overwrite GOARCH in makefile - go mod tidy && go mod vendor --- .ci-operator.yaml | 4 ++ .github/ISSUE_TEMPLATE/bug_report.md | 24 ------- .github/ISSUE_TEMPLATE/enhancement-request.md | 20 ------ .github/ISSUE_TEMPLATE/feature_request.md | 18 ----- .github/ISSUE_TEMPLATE/support-request.md | 20 ------ .github/PULL_REQUEST_TEMPLATE.md | 5 -- .github/workflows/codeql-analysis.yml | 67 ------------------- .github/workflows/container-image.yaml | 40 ----------- .github/workflows/cr.yaml | 1 - .github/workflows/helm-chart-release.yaml | 27 -------- .github/workflows/release.yaml | 28 -------- .snyk | 7 ++ Dockerfile.openshift | 18 +++++ Makefile | 4 +- OWNERS | 15 +---- OWNERS_ALIASES | 9 +++ 16 files changed, 44 insertions(+), 263 deletions(-) create mode 100644 .ci-operator.yaml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/enhancement-request.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/support-request.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/container-image.yaml delete mode 100644 .github/workflows/cr.yaml delete mode 100644 .github/workflows/helm-chart-release.yaml delete mode 100644 .github/workflows/release.yaml create mode 100644 .snyk create mode 100644 Dockerfile.openshift create mode 100644 OWNERS_ALIASES diff --git a/.ci-operator.yaml b/.ci-operator.yaml new file mode 100644 index 000000000..1e59c02c2 --- /dev/null +++ b/.ci-operator.yaml @@ -0,0 +1,4 @@ +build_root_image: + name: release + namespace: openshift + tag: rhel-9-release-golang-1.22-openshift-4.17 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 2a9c1a1a9..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve EFS CSI Driver -labels: - ---- - -/kind bug - -**What happened?** - -**What you expected to happen?** - -**How to reproduce it (as minimally and precisely as possible)?** - -**Anything else we need to know?**: - -**Environment** -- Kubernetes version (use `kubectl version`): -- Driver version: - -**Please also attach debug logs to help us better diagnose** - -- Instructions to gather debug logs can be found [here](https://github.com/kubernetes-sigs/aws-efs-csi-driver/tree/master/troubleshooting) diff --git a/.github/ISSUE_TEMPLATE/enhancement-request.md b/.github/ISSUE_TEMPLATE/enhancement-request.md deleted file mode 100644 index be29973b7..000000000 --- a/.github/ISSUE_TEMPLATE/enhancement-request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Enhancement request -about: Suggest an idea for this project -labels: - ---- - -**Is your feature request related to a problem?/Why is this needed** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -/feature - -**Describe the solution you'd like in detail** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 5ab2ef224..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -labels: - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like in detail** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/support-request.md b/.github/ISSUE_TEMPLATE/support-request.md deleted file mode 100644 index 27f1327ce..000000000 --- a/.github/ISSUE_TEMPLATE/support-request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Support request -about: Ask questions about the driver -labels: - ---- - - - - - -/triage support diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index af456770e..000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,5 +0,0 @@ -**Is this a bug fix or adding new feature?** - -**What is this PR about? / Why do we need it?** - -**What testing is done?** diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 9b5475226..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,67 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master, release-0.1.0, release-0.2.0, release-0.3, release-1.0, release-1.1 ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '33 20 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'go' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/container-image.yaml b/.github/workflows/container-image.yaml deleted file mode 100644 index 3828a5117..000000000 --- a/.github/workflows/container-image.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Container Images - -on: push -jobs: - build: - # this is to prevent the job to run at forked projects - if: github.repository == 'kubernetes-sigs/aws-efs-csi-driver' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up Docker Buildx - id: buildx - uses: crazy-max/ghaction-docker-buildx@v3 - with: - buildx-version: latest - qemu-version: latest - - name: Push to Dockerhub registry - run: | - BRANCH=$(echo $GITHUB_REF | cut -d'/' -f3) - SHORT_SHA=$(echo $GITHUB_SHA | cut -c -7) - REPO=amazon/aws-efs-csi-driver - if [ "$BRANCH" = "master" ]; then - TAG=$SHORT_SHA - else - TAG=$BRANCH - fi - docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} - - docker buildx build \ - -t $REPO:$TAG \ - --platform=linux/amd64,linux/arm64 \ - --progress plain \ - --push . - if [ "$BRANCH" = "master" ]; then - docker buildx build \ - -t $REPO:master \ - --platform=linux/amd64,linux/arm64 \ - --progress plain \ - --push . - fi diff --git a/.github/workflows/cr.yaml b/.github/workflows/cr.yaml deleted file mode 100644 index 6e2fe6c3f..000000000 --- a/.github/workflows/cr.yaml +++ /dev/null @@ -1 +0,0 @@ -release-name-template: "helm-chart-{{ .Name }}-{{ .Version }}" diff --git a/.github/workflows/helm-chart-release.yaml b/.github/workflows/helm-chart-release.yaml deleted file mode 100644 index 737c34714..000000000 --- a/.github/workflows/helm-chart-release.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Release Helm Charts - -on: - push: - branches: - - master - paths: - - "charts/**" - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.1.0 - env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - with: - config: .github/workflows/cr.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index b8b5149be..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: Release -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 -jobs: - build: - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v1 - - name: Create Release - id: create-release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - body: | - AWS EFS CSI Driver - - ## CHANGELOG - See [CHANGELOG](https://github.com/kubernetes-sigs/aws-efs-csi-driver/blob/master/CHANGELOG-2.x.md) for full list of changes - draft: false - prerelease: false diff --git a/.snyk b/.snyk new file mode 100644 index 000000000..8c1054ef8 --- /dev/null +++ b/.snyk @@ -0,0 +1,7 @@ +# References: +# https://docs.snyk.io/scan-applications/snyk-code/using-snyk-code-from-the-cli/excluding-directories-and-files-from-the-snyk-code-cli-test +# https://docs.snyk.io/snyk-cli/commands/ignore +exclude: + global: + - vendor/** + - troubleshooting/log_collector.py diff --git a/Dockerfile.openshift b/Dockerfile.openshift new file mode 100644 index 000000000..1be75c0be --- /dev/null +++ b/Dockerfile.openshift @@ -0,0 +1,18 @@ +FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.17 AS builder +WORKDIR /go/src/github.com/kubernetes-sigs/aws-efs-csi-driver +COPY . . +RUN make bin/aws-efs-csi-driver + +# Use a base image with aws-efs-utils installed +FROM registry.ci.openshift.org/ocp/4.17:aws-efs-utils-base + +# From the upstream Dockerfile: +# At image build time, static files installed by efs-utils in the config directory, i.e. CAs file, need +# to be saved in another place so that the other stateful files created at runtime, i.e. private key for +# client certificate, in the same config directory can be persisted to host with a host path volume. +# Otherwise creating a host path volume for that directory will clean up everything inside at the first time. +# Those static files need to be copied back to the config directory when the driver starts up. +RUN mv /etc/amazon/efs /etc/amazon/efs-static-files + +COPY --from=builder /go/src/github.com/kubernetes-sigs/aws-efs-csi-driver/bin/aws-efs-csi-driver /usr/bin/ +ENTRYPOINT ["/usr/bin/aws-efs-csi-driver"] diff --git a/Makefile b/Makefile index 04f61a35f..031d8c8c1 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,9 @@ word-hyphen = $(word $2,$(subst -, ,$1)) .PHONY: linux/$(ARCH) bin/aws-efs-csi-driver linux/$(ARCH): bin/aws-efs-csi-driver bin/aws-efs-csi-driver: | bin - CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -mod=vendor -ldflags ${LDFLAGS} -o bin/aws-efs-csi-driver ./cmd/ +# OpenShift: : do not overwrite GOARCH, use the one provided by the builder. + @echo GOARCH:${GOARCH} + CGO_ENABLED=0 GOOS=linux go build -mod=vendor -ldflags ${LDFLAGS} -o bin/aws-efs-csi-driver ./cmd/ .PHONY: all all: all-image-docker diff --git a/OWNERS b/OWNERS index 378da8c78..ed2b0bbe7 100644 --- a/OWNERS +++ b/OWNERS @@ -1,13 +1,4 @@ -# See the OWNERS docs at https://go.k8s.io/owners - approvers: -- d-nishi -- leakingtapan -- justinsb -- jsafrane -- wongma7 -- nckturner -- jqmichael -- Ashley-wenyizha -- mskanth972 -- seanzatzdev-amazon +- openshift-storage-maintainers +component: "Storage" + diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES new file mode 100644 index 000000000..c44802504 --- /dev/null +++ b/OWNERS_ALIASES @@ -0,0 +1,9 @@ +aliases: + openshift-storage-maintainers: + - jsafrane + - tsmetana + - gnufied + - bertinatto + - dobsonj + - RomanBednar + - mpatlasov