Skip to content

Commit

Permalink
Add Istio virtual service and signal packages
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprodan committed Mar 5, 2019
1 parent f7c4d5a commit b0b6198
Show file tree
Hide file tree
Showing 39 changed files with 1,187 additions and 364 deletions.
12 changes: 5 additions & 7 deletions cmd/flagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@ package main

import (
"flag"
"go.uber.org/zap"
"log"
"time"

_ "github.com/istio/glog"
istioclientset "github.com/knative/pkg/client/clientset/versioned"
"github.com/knative/pkg/signals"
clientset "github.com/stefanprodan/flagger/pkg/client/clientset/versioned"
informers "github.com/stefanprodan/flagger/pkg/client/informers/externalversions"
"github.com/stefanprodan/flagger/pkg/controller"
"github.com/stefanprodan/flagger/pkg/logging"
"github.com/stefanprodan/flagger/pkg/notifier"
"github.com/stefanprodan/flagger/pkg/server"
"github.com/stefanprodan/flagger/pkg/signals"
"github.com/stefanprodan/flagger/pkg/version"
"go.uber.org/zap"
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"log"
"time"
)

var (
Expand Down Expand Up @@ -77,7 +75,7 @@ func main() {
logger.Fatalf("Error building kubernetes clientset: %v", err)
}

istioClient, err := istioclientset.NewForConfig(cfg)
istioClient, err := clientset.NewForConfig(cfg)
if err != nil {
logger.Fatalf("Error building istio clientset: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/loadtester/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package main

import (
"flag"
"github.com/knative/pkg/signals"
"github.com/stefanprodan/flagger/pkg/loadtester"
"github.com/stefanprodan/flagger/pkg/logging"
"github.com/stefanprodan/flagger/pkg/signals"
"go.uber.org/zap"
"log"
"time"
Expand Down
2 changes: 1 addition & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge

${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
github.com/stefanprodan/flagger/pkg/client github.com/stefanprodan/flagger/pkg/apis \
flagger:v1alpha3 \
"istio:v1alpha3 flagger:v1alpha3" \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt

2 changes: 1 addition & 1 deletion pkg/apis/flagger/v1alpha3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package v1alpha3

import (
istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3"
istiov1alpha3 "github.com/stefanprodan/flagger/pkg/apis/istio/v1alpha3"
hpav1 "k8s.io/api/autoscaling/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"time"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/flagger/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions pkg/apis/istio/common/v1alpha1/string.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package v1alpha1

// Describes how to match a given string in HTTP headers. Match is
// case-sensitive.
type StringMatch struct {
// Specified exactly one of the fields below.

// exact string match
Exact string `json:"exact,omitempty"`

// prefix-based match
Prefix string `json:"prefix,omitempty"`

// suffix-based match.
Suffix string `json:"suffix,omitempty"`

// ECMAscript style regex-based match
Regex string `json:"regex,omitempty"`
}
5 changes: 5 additions & 0 deletions pkg/apis/istio/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package istio

const (
GroupName = "networking.istio.io"
)
7 changes: 7 additions & 0 deletions pkg/apis/istio/v1alpha3/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Api versions allow the api contract for a resource to be changed while keeping
// backward compatibility by support multiple concurrent versions
// of the same resource

// +k8s:deepcopy-gen=package
// +groupName=networking.istio.io
package v1alpha3
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
/*
Copyright 2018 The Knative 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.
*/

package v1alpha3

import (
"github.com/knative/pkg/apis/istio"
"github.com/stefanprodan/flagger/pkg/apis/istio"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -45,11 +29,7 @@ var (
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&VirtualService{},
&Gateway{},
&DestinationRule{},
&VirtualServiceList{},
&GatewayList{},
&DestinationRuleList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
Expand Down
Loading

0 comments on commit b0b6198

Please sign in to comment.