-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Create container image of utility tools not avialable in production containers #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
b39b200
feat: Create container image of utility tools not avialable in produc…
mrajagopal 98a5ca5
Merge branch 'main' into mrajagopal-utils-pod
mrajagopal fed2bf3
feat: introduce NGINX API stats script
mrajagopal bd77d7b
Added additional tools for troubleshooting
mrajagopal d49821f
Fix: api_stats.sh improvements
mrajagopal 742a308
Feat: Add docker-build.yml to githb workflow
mrajagopal 90eac87
Fix: copy the local file correctly using Dockerfile syntax
mrajagopal 053a479
fix: debug docker build workflow in github actions
mrajagopal 47cc68e
Fix: copy file properly in Dockerfile
mrajagopal 71e82a3
Fix: fix docker image push failure
mrajagopal 60ac1ac
Fix: push container image to GHCR
mrajagopal 36d1e3e
Feat: Add trivy vulnerability scan and upload report via github workflow
mrajagopal c4985c3
fix: vulnerability scan
mrajagopal 8c18049
fix: vulnerability scan and report upload
mrajagopal 9184914
fix: vulnerability report upload
mrajagopal bae4b72
fix: upload artifact vuln report
mrajagopal c70c569
Merge branch 'main' into mrajagopal-utils-pod
mrajagopal ea96377
Chore: Added opencontainerer annotations to the nginx-utils image
mrajagopal 141aebb
Fix: Address workflow persmissions
mrajagopal 3c17608
Fix: Use recent releases for workflow jobs pipeline
mrajagopal e20a960
Feat: Added memory stats script to the container image
mrajagopal 75fc05c
Fix: Output JSON raw for unformatted redirection to file
mrajagopal c7aa018
Chore: Change docker-build workflow
mrajagopal bae23ef
Fix: Build container image on release trigger
mrajagopal 47baa6d
Fix: Added muti-platform directive to docker-build workflow
mrajagopal ebc3ab8
Fix: Add build tags based on release tag to docker-build workflow
mrajagopal 7d01e3b
Fix: Build the container based -docker release name
mrajagopal cedd60f
Fix: Build the krew based on -krew in the release name
mrajagopal 6c73187
Fix: Add docker image info to release notes via dock-build workflow
mrajagopal 727620e
feat: strip prefix in krew release version tags
dareste b9aa761
Fix: Strip suffix in docker image release tag
mrajagopal f94e888
Merge branch 'main' into mrajagopal-utils-pod
mrajagopal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build and Push Docker Image for nginx-utils container | ||
on: | ||
push: | ||
branches: | ||
- mrajagopal-utils-pod | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Debug: Verify api_stats.sh and repository content | ||
- name: List repository files | ||
run: ls -R .; pwd | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: nginx-utils/Dockerfile | ||
push: true | ||
tags: ghcr.io/nginx/nginx-utils:latest | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
.PHONY: nginx-utils build install | ||
build: | ||
go build -o cmd/kubectl-nginx_supportpkg | ||
|
||
nginx-utils: | ||
docker buildx build --build-context project=nginx-utils --platform linux/amd64 -t nginx-utils -f nginx-utils/Dockerfile . | ||
|
||
install: build | ||
sudo cp cmd/kubectl-nginx_supportpkg /usr/local/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM alpine:latest | ||
COPY --chmod=744 nginx-utils/api_stats.sh /root/api_stats.sh | ||
|
||
RUN set -ex \ | ||
&& apk --update add --no-cache \ | ||
bind-tools curl netcat-openbsd iproute2 \ | ||
iperf tcpdump tshark bash jq \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& ln -s /usr/bin/iperf /usr/local/bin/iperf \ | ||
&& ls -altrh /usr/local/bin/iperf | ||
|
||
# Setting User and Home | ||
USER root | ||
WORKDIR /root | ||
ENV HOSTNAME=nginx-utils | ||
|
||
CMD ["bash"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Parse command line options | ||
set -e | ||
set -o pipefail | ||
while getopts "p:v:h" opt; do | ||
case $opt in | ||
p) API_PORT="$OPTARG" | ||
;; | ||
h) echo "Usage: $0 [-p port]" | ||
exit 0 | ||
;; | ||
\?) echo "Invalid option -$OPTARG" >&2 | ||
echo "Usage: $0 [-p port]" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [ $OPTIND -eq 1 ]; then | ||
echo "No options were passed, exiting ..." | ||
echo "Usage: $(basename "$0") [-p port]" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${API_PORT}" ]; then | ||
echo 'Missing -p arg' >&2 | ||
exit 1 | ||
fi | ||
|
||
api_versions=($(curl http://127.0.0.1:$API_PORT/api/ | sed -e 's/\[//g' -e 's/\]//g' -e 's/\,/ /g')) | ||
API_VERSION=${api_versions[-1]} | ||
echo "API_VERSION: $API_VERSION" | ||
|
||
echo "**** /api/$API_VERSION/nginx ****" ; | ||
curl -s "127.0.0.1:$API_PORT/api/$API_VERSION/nginx" | jq .; | ||
echo ""; | ||
|
||
for i in /api/$API_VERSION/processes /api/$API_VERSION/connections /api/$API_VERSION/slabs /api/$API_VERSION/http/requests /api/$API_VERSION/http/server_zones /api/$API_VERSION/http/location_zones /api/$API_VERSION/http/caches /api/$API_VERSION/http/upstreams /api/$API_VERSION/http/keyvals; do | ||
echo "**** $i ****" ; | ||
curl -s "127.0.0.1:$API_PORT/$i" | jq .; | ||
echo ""; | ||
done |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.