Skip to content

Commit

Permalink
Include Channel’s ExternalName services in Istio mesh (knative-extens…
Browse files Browse the repository at this point in the history
…ions#16)

* Include Channel’s ExternalName services in Istio mesh

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Run hack/update-codegen.sh

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Format

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Test and release setup

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Upgrade dependencies

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Add IMC and KafkaChannel tests

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Format and fix tests

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Upgrade dependencies

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Add access to configmaps

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Add config-features for testing and install script for dev

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Debug logging for istio enabled

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Fix controller

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Include knative-extensions/eventing-kafka-broker#3045

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Use core zap

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Fix unit tests

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Add unit tests

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Upgrade dependencies and artifacts

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Fix host name

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Upgrade dependencies

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Upgrade dependencies

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Upgrade deps and artifacts

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Add full config-features

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Fix boilerplate check

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Improve log message

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* More boilerplate check fixes

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Update codegen

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

---------

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
  • Loading branch information
pierDipi committed May 4, 2023
1 parent 3e98c07 commit 3d52a70
Show file tree
Hide file tree
Showing 4,422 changed files with 1,153,950 additions and 2,782 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
third_party/istio/bin
/third_party/istio/bin
/eventing-istio.yaml
73 changes: 73 additions & 0 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
Copyright 2023 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 main

import (
"errors"
"log"
"net/http"
"os"
"time"

"knative.dev/pkg/injection/sharedmain"
"knative.dev/pkg/signals"

istiofilteredfactory "knative.dev/eventing-istio/pkg/client/istio/injection/informers/factory/filtered"
"knative.dev/eventing-istio/pkg/reconciler/service"
)

func main() {

ctx := signals.NewContext()

port := os.Getenv("PROBES_PORT")
if port == "" {
port = "8080"
}

// sets up liveness and readiness probes.
server := http.Server{
ReadTimeout: 5 * time.Second,
Handler: http.HandlerFunc(handler),
Addr: ":" + port,
}

go func() {

go func() {
<-ctx.Done()
_ = server.Shutdown(ctx)
}()

// start the web server on port and accept requests
log.Printf("Readiness and health check server listening on port %s", port)

if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Fatal(err)
}
}()

ctx = istiofilteredfactory.WithSelectors(ctx, service.IstioResourceSelector)

sharedmain.MainWithContext(ctx, "eventing-istio-controller",
service.NewController,
)
}

func handler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
40 changes: 40 additions & 0 deletions config/eventing-istio/controller/200-eventing-serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2023 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.

apiVersion: v1
kind: ServiceAccount
metadata:
name: eventing-istio-controller
namespace: knative-eventing
labels:
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing

---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: eventing-istio-controller
labels:
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing
subjects:
- kind: ServiceAccount
name: eventing-istio-controller
namespace: knative-eventing
roleRef:
kind: ClusterRole
name: knative-eventing-istio-controller
apiGroup: rbac.authorization.k8s.io
110 changes: 110 additions & 0 deletions config/eventing-istio/controller/500-controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright 2023 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.

apiVersion: apps/v1
kind: Deployment
metadata:
name: eventing-istio-controller
namespace: knative-eventing
labels:
knative.dev/high-availability: "true"
app.kubernetes.io/component: eventing-istio-controller
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing
spec:
selector:
matchLabels:
app: eventing-istio-controller
template:
metadata:
labels:
app: eventing-istio-controller
app.kubernetes.io/component: eventing-istio-controller
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing
spec:
# To avoid node becoming SPOF, spread our replicas to different nodes.
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app: eventing-istio-controller
topologyKey: kubernetes.io/hostname
weight: 100

serviceAccountName: eventing-istio-controller
enableServiceLinks: false
containers:
- name: eventing-istio-controller
terminationMessagePolicy: FallbackToLogsOnError
image: ko://knative.dev/eventing-istio/cmd/controller

resources:
requests:
cpu: 100m
memory: 100Mi

env:
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: CONFIG_LOGGING_NAME
value: config-logging
- name: CONFIG_OBSERVABILITY_NAME
value: config-observability
- name: METRICS_DOMAIN
value: knative.dev/eventing-istio
# APIServerSource
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name

securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault

livenessProbe:
httpGet:
path: /health
port: probes
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /readiness
port: probes
scheme: HTTP
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 5

ports:
- name: metrics
containerPort: 9090
- name: profiling
containerPort: 8008
- name: probes
containerPort: 8080
58 changes: 58 additions & 0 deletions config/eventing-istio/roles/controller-clusterroles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2023 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.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: knative-eventing-istio-controller
labels:
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing
rules:
- apiGroups:
- ""
resources:
- "services"
- "configmaps"
verbs:
- "get"
- "list"
- "watch"

- apiGroups:
- "networking.istio.io"
resources:
- "destinationrules"
verbs: &everything
- "get"
- "list"
- "create"
- "update"
- "delete"
- "patch"
- "watch"

# For leader election
- apiGroups:
- "coordination.k8s.io"
resources:
- "leases"
verbs: *everything

# For creating events and reporting errors
- apiGroups:
- ""
resources:
- "events"
verbs: *everything
62 changes: 58 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,92 @@ module knative.dev/eventing-istio
go 1.19

require (
knative.dev/hack v0.0.0-20230309131425-1eebfb3184f8
knative.dev/pkg v0.0.0-20230309013522-c5dd1d1264ba
github.com/google/go-cmp v0.5.8
github.com/hashicorp/golang-lru v0.5.4
go.uber.org/zap v1.21.0
google.golang.org/protobuf v1.30.0
istio.io/api v0.0.0-20221208070204-0528cb6ce63b
istio.io/client-go v1.16.1
k8s.io/api v0.25.4
k8s.io/apimachinery v0.25.4
k8s.io/client-go v0.25.4
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2
knative.dev/eventing v0.37.1-0.20230502135555-66e8257b9c83
knative.dev/hack v0.0.0-20230501013555-7d81248b4638
knative.dev/pkg v0.0.0-20230502134655-db8a35330281
)

require (
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.0 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/go-kit/log v0.1.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/imdario/mergo v0.3.9 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/statsd_exporter v0.21.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/automaxprocs v1.4.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/tools v0.1.12 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/api v0.61.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 // indirect
google.golang.org/grpc v1.47.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.25.4 // indirect
k8s.io/apiextensions-apiserver v0.25.4 // indirect
k8s.io/code-generator v0.25.4 // indirect
k8s.io/gengo v0.0.0-20221011193443-fad74ee6edd9 // indirect
k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit 3d52a70

Please sign in to comment.