Feature flag to enable/disable canary + optional prometheus install (#937)

This commit is contained in:
smruthi2187
2018-10-22 15:24:43 -07:00
committed by GitHub
parent e7f1d4564a
commit 0a8c6e97a6
20 changed files with 304 additions and 28 deletions
+26
View File
@@ -25,10 +25,16 @@ import (
log "github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fission/fission"
"github.com/fission/fission/crd"
)
func (a *API) CanaryConfigApiCreate(w http.ResponseWriter, r *http.Request) {
if !a.featureConfig.CanaryConfig.IsEnabled {
a.respondWithError(w, fission.MakeError(http.StatusBadRequest, "Please enable canary feature while installing fission"))
return
}
body, err := ioutil.ReadAll(r.Body)
if err != nil {
a.respondWithError(w, err)
@@ -60,6 +66,11 @@ func (a *API) CanaryConfigApiCreate(w http.ResponseWriter, r *http.Request) {
}
func (a *API) CanaryConfigApiGet(w http.ResponseWriter, r *http.Request) {
if !a.featureConfig.CanaryConfig.IsEnabled {
a.respondWithError(w, fission.MakeError(http.StatusBadRequest, "Please enable canary feature while installing fission"))
return
}
vars := mux.Vars(r)
name := vars["canaryConfig"]
@@ -84,6 +95,11 @@ func (a *API) CanaryConfigApiGet(w http.ResponseWriter, r *http.Request) {
}
func (a *API) CanaryConfigApiList(w http.ResponseWriter, r *http.Request) {
if !a.featureConfig.CanaryConfig.IsEnabled {
a.respondWithError(w, fission.MakeError(http.StatusBadRequest, "Please enable canary feature while installing fission"))
return
}
ns := a.extractQueryParamFromRequest(r, "namespace")
if len(ns) == 0 {
ns = metav1.NamespaceDefault
@@ -105,6 +121,11 @@ func (a *API) CanaryConfigApiList(w http.ResponseWriter, r *http.Request) {
}
func (a *API) CanaryConfigApiUpdate(w http.ResponseWriter, r *http.Request) {
if !a.featureConfig.CanaryConfig.IsEnabled {
a.respondWithError(w, fission.MakeError(http.StatusBadRequest, "Please enable canary feature while installing fission"))
return
}
body, err := ioutil.ReadAll(r.Body)
if err != nil {
a.respondWithError(w, err)
@@ -134,6 +155,11 @@ func (a *API) CanaryConfigApiUpdate(w http.ResponseWriter, r *http.Request) {
}
func (a *API) CanaryConfigApiDelete(w http.ResponseWriter, r *http.Request) {
if !a.featureConfig.CanaryConfig.IsEnabled {
a.respondWithError(w, fission.MakeError(http.StatusBadRequest, "Please enable canary feature while installing fission"))
return
}
vars := mux.Vars(r)
name := vars["canaryConfig"]
ns := a.extractQueryParamFromRequest(r, "namespace")