Skip to content

Commit

Permalink
Add second webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha committed Feb 10, 2018
1 parent 419c4db commit 4fbcd77
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion artifacts/kube-install/apiserver-list.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ items:
serviceAccountName: server
containers:
- name: c
image: your-docker-user-name/namespace-reservation-server:latest
image: tigerworks/namespace-reservation-server:latest
imagePullPolicy: IfNotPresent
command:
- "/usr/bin/namespace-reservation-server"
Expand Down
27 changes: 26 additions & 1 deletion cmd/namespacereservationserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,34 @@ import (
)

func main() {
cmd.RunAdmissionServer(&admissionHook{})
cmd.RunAdmissionServer(&admissionHook{}, &secondHook{})
}

// ---------------------------------------------------------------
type secondHook struct {
}

func (a *secondHook) ValidatingResource() (plural schema.GroupVersionResource, singular string) {
return schema.GroupVersionResource{
Group: "admission.online.openshift.io",
Version: "v1beta1",
Resource: "seconds",
},
"second"
}

func (a *secondHook) Validate(admissionSpec *admissionv1beta1.AdmissionRequest) *admissionv1beta1.AdmissionResponse {
return &admissionv1beta1.AdmissionResponse{
Allowed: true,
}
}

func (a *secondHook) Initialize(kubeClientConfig *rest.Config, stopCh <-chan struct{}) error {
return nil
}

//----------------------------------------------------------------

type admissionHook struct {
reservationClient dynamic.ResourceInterface

Expand Down

0 comments on commit 4fbcd77

Please sign in to comment.