-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Remove fastcgi feature" (#10081)
* Revert "Remove fastcgi feature (#9864)" This reverts commit 90ed0cc. * revert fastcgi* annotations warning Signed-off-by: Jintao Zhang <[email protected]> --------- Signed-off-by: Jintao Zhang <[email protected]>
- Loading branch information
1 parent
f1e3f2f
commit cccba35
Showing
25 changed files
with
975 additions
and
159 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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,59 @@ | ||
# Copyright 2020 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Docker image for e2e testing. | ||
|
||
# set default shell | ||
SHELL=/bin/bash -o pipefail -o errexit | ||
|
||
DIR:=$(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))) | ||
INIT_BUILDX=$(DIR)/../../hack/init-buildx.sh | ||
|
||
SHORT_SHA ?=$(shell git rev-parse --short HEAD) | ||
TAG ?=v$(shell date +%Y%m%d)-$(SHORT_SHA) | ||
|
||
REGISTRY ?= local | ||
|
||
IMAGE = $(REGISTRY)/e2e-test-fastcgi-helloserver | ||
|
||
# required to enable buildx | ||
export DOCKER_CLI_EXPERIMENTAL=enabled | ||
|
||
# build with buildx | ||
PLATFORMS?=linux/amd64,linux/arm,linux/arm64 | ||
OUTPUT= | ||
PROGRESS=plain | ||
|
||
build: ensure-buildx | ||
docker buildx build \ | ||
--platform=${PLATFORMS} $(OUTPUT) \ | ||
--progress=$(PROGRESS) \ | ||
--pull \ | ||
-t $(IMAGE):$(TAG) rootfs | ||
|
||
# push the cross built image | ||
push: OUTPUT=--push | ||
push: build | ||
|
||
# enable buildx | ||
ensure-buildx: | ||
# this is required for cloudbuild | ||
ifeq ("$(wildcard $(INIT_BUILDX))","") | ||
@curl -sSL https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/hack/init-buildx.sh | bash | ||
else | ||
@exec $(INIT_BUILDX) | ||
endif | ||
@echo "done" | ||
|
||
.PHONY: build push ensure-buildx |
This file contains 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,22 @@ | ||
timeout: 1800s | ||
options: | ||
substitution_option: ALLOW_LOOSE | ||
steps: | ||
- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20211118-2f2d816b90 | ||
entrypoint: bash | ||
env: | ||
- DOCKER_CLI_EXPERIMENTAL=enabled | ||
- SHORT_SHA=$SHORT_SHA | ||
- BASE_REF=$_PULL_BASE_REF | ||
- REGISTRY=gcr.io/k8s-staging-ingress-nginx | ||
# default cloudbuild has HOME=/builder/home and docker buildx is in /root/.docker/cli-plugins/docker-buildx | ||
# set the home to /root explicitly to if using docker buildx | ||
- HOME=/root | ||
args: | ||
- -c | ||
- | | ||
gcloud auth configure-docker \ | ||
&& cd images/fastcgi-helloserver && make push | ||
substitutions: | ||
_GIT_TAG: "12345" | ||
_PULL_BASE_REF: "master" |
This file contains 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,32 @@ | ||
# Copyright 2017 The Kubernetes Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM golang:1.20.4-alpine3.18 as builder | ||
|
||
WORKDIR /go/src/k8s.io/ingress-nginx/images/fastcgi | ||
|
||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 go build -a -installsuffix cgo \ | ||
-ldflags "-s -w" \ | ||
-o fastcgi-helloserver main.go | ||
|
||
# Use distroless as minimal base image to package the binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot | ||
|
||
COPY --from=builder /go/src/k8s.io/ingress-nginx/images/fastcgi/fastcgi-helloserver / | ||
USER nonroot:nonroot | ||
|
||
CMD ["/fastcgi-helloserver"] |
This file contains 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,30 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"net/http" | ||
"net/http/fcgi" | ||
) | ||
|
||
func hello(w http.ResponseWriter, r *http.Request) { | ||
keys, ok := r.URL.Query()["name"] | ||
|
||
if !ok || len(keys[0]) < 1 { | ||
fmt.Fprintf(w, "Hello world!") | ||
return | ||
} | ||
|
||
key := keys[0] | ||
fmt.Fprintf(w, "Hello "+string(key)+"!") | ||
} | ||
|
||
func main() { | ||
http.HandleFunc("/hello", hello) | ||
|
||
l, err := net.Listen("tcp", "0.0.0.0:9000") | ||
if err != nil { | ||
panic(err) | ||
} | ||
fcgi.Serve(l, nil) | ||
} |
This file contains 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
Oops, something went wrong.