Skip to content

Commit 43422b8

Browse files
fix token bug and buildKind.sh (#190)
Co-authored-by: David Hadas <david.hadas@gmail.com>
1 parent 31a5f2d commit 43422b8

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

hack/kind/deployKind.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,33 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
CONFIG="$(mktemp)"
18+
cat <<EOF > $CONFIG
19+
kind: Cluster
20+
apiVersion: kind.x-k8s.io/v1alpha4
21+
name: k8s
22+
nodes:
23+
- role: control-plane
24+
kubeadmConfigPatches:
25+
- |
26+
kind: InitConfiguration
27+
nodeRegistration:
28+
kubeletExtraArgs:
29+
node-labels: "ingress-ready=true"
30+
extraPortMappings:
31+
- containerPort: 80
32+
hostPort: 80
33+
protocol: TCP
34+
- containerPort: 443
35+
hostPort: 443
36+
protocol: TCP
37+
EOF
38+
39+
40+
1741
# Create Kind cluster
1842
kind delete cluster --name k8s
19-
kind create cluster --config ./hack/kind/kind-config.yaml
43+
kind create cluster --config $CONFIG
2044
kubectl cluster-info --context kind-k8s
2145
kubectl create namespace knative-serving
2246
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
@@ -48,3 +72,6 @@ kubectl apply -f https://github.com/knative-sandbox/security-guard/releases/down
4872

4973
#add myapp - protected using a separate guard pod (non-recommended pattern)
5074
kubectl apply -f https://github.com/knative-sandbox/security-guard/releases/download/v0.5.0/secured-layered-myapp.yaml
75+
76+
#cleanup
77+
rm $CONFIG

pkg/guard-gate/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ func (hc *httpClient) ReadToken(audience string) (tokenActive bool) {
6868
if hc.tokenRefreshTime.After(now) {
6969
return
7070
}
71-
// refresh in 100 minuets
72-
hc.tokenRefreshTime = now.Add(100 * time.Minute)
71+
// refresh in 5 minuets
72+
hc.tokenRefreshTime = now.Add(5 * time.Minute)
7373

7474
// TODO: replace "/var/run/secrets/tokens" with sharedMain.QPOptionTokenDirPath once merged.
7575
b, err := os.ReadFile(path.Join("/var/run/secrets/tokens", audience))

0 commit comments

Comments
 (0)