Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions grumpy.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ func (gs *GrumpyServerHandler) serve(w http.ResponseWriter, r *http.Request) {
glog.Error("error deserializing pod")
return
}
if pod.Name == "smooth-app" {
return
}


arResponse := v1beta1.AdmissionReview{
Response: &v1beta1.AdmissionResponse{
Allowed: false,
Expand All @@ -60,6 +57,16 @@ func (gs *GrumpyServerHandler) serve(w http.ResponseWriter, r *http.Request) {
},
},
}

if pod.Name == "smooth-app" {
fmt.Printf("the pod %s is up to the name standard", pod.Name)
arResponse.Response.Allowed = true
}

arResponse.APIVersion = "admission.k8s.io/v1"
arResponse.Kind = arRequest.Kind
arResponse.Response.UID = arRequest.Request.UID

resp, err := json.Marshal(arResponse)
if err != nil {
glog.Errorf("Can't encode response: %v", err)
Expand Down
7 changes: 5 additions & 2 deletions manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
selector:
name: grumpy
---
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: grumpy
Expand All @@ -23,6 +23,9 @@ metadata:
name: grumpy
spec:
replicas: 1
selector:
matchLabels:
name: grumpy
template:
metadata:
name: grumpy
Expand Down Expand Up @@ -60,7 +63,7 @@ spec:
- name: logs
emptyDir: {}
---
apiVersion: admissionregistration.k8s.io/v1beta1
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: grumpy
Expand Down