Skip to content

Commit

Permalink
Merge pull request #8 from msherif1234/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
Andrew Stoycos committed May 29, 2024
2 parents c91edf5 + 7f71813 commit 8c60b32
Show file tree
Hide file tree
Showing 1,650 changed files with 118,388 additions and 66,664 deletions.
47 changes: 34 additions & 13 deletions cmd/bpfman-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,30 @@ package main

import (
"context"
"crypto/tls"
"flag"
"fmt"
"os"

"go.uber.org/zap/zapcore"
_ "k8s.io/client-go/plugin/pkg/client/auth"
bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagent "github.com/bpfman/bpfman-operator/controllers/bpfman-agent"

"github.com/bpfman/bpfman-operator/internal/conn"
gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1"

"go.uber.org/zap/zapcore"
"google.golang.org/grpc/credentials/insecure"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagent "github.com/bpfman/bpfman-operator/controllers/bpfman-agent"

"github.com/bpfman/bpfman-operator/internal/conn"
gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"
//+kubebuilder:scaffold:imports
)

Expand All @@ -59,8 +61,11 @@ func main() {
var metricsAddr string
var probeAddr string
var opts zap.Options
var enableHTTP2 bool

flag.StringVar(&metricsAddr, "metrics-bind-address", ":8174", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8175", "The address the probe endpoint binds to.")
flag.BoolVar(&enableHTTP2, "enable-http2", enableHTTP2, "If HTTP/2 should be enabled for the metrics and webhook servers.")
flag.Parse()

// Get the Log level for bpfman deployment where this pod is running
Expand All @@ -85,16 +90,32 @@ func main() {
}
}

disableHTTP2 := func(c *tls.Config) {
if enableHTTP2 {
return
}
c.NextProtos = []string{"http/1.1"}
}

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Scheme: scheme,
Metrics: server.Options{
BindAddress: metricsAddr,
TLSOpts: []func(*tls.Config){disableHTTP2},
},
WebhookServer: webhook.NewServer(webhook.Options{
Port: 9443,
TLSOpts: []func(*tls.Config){disableHTTP2},
}),
HealthProbeBindAddress: probeAddr,
LeaderElection: false,
// Specify that Secrets's should not be cached.
ClientDisableCacheFor: []client.Object{&v1.Secret{}},
Client: client.Options{Cache: &client.CacheOptions{
DisableFor: []client.Object{&v1.Secret{}},
},
},
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down
35 changes: 26 additions & 9 deletions cmd/bpfman-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,24 @@ limitations under the License.
package main

import (
"crypto/tls"
"flag"
"os"

"go.uber.org/zap/zapcore"
_ "k8s.io/client-go/plugin/pkg/client/auth"
bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanoperator "github.com/bpfman/bpfman-operator/controllers/bpfman-operator"
"github.com/bpfman/bpfman-operator/internal"

"go.uber.org/zap/zapcore"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanoperator "github.com/bpfman/bpfman-operator/controllers/bpfman-operator"
"github.com/bpfman/bpfman-operator/internal"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"
//+kubebuilder:scaffold:imports
)

Expand All @@ -52,11 +54,13 @@ func main() {
var enableLeaderElection bool
var probeAddr string
var opts zap.Options
var enableHTTP2 bool
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8174", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8175", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.BoolVar(&enableHTTP2, "enable-http2", enableHTTP2, "If HTTP/2 should be enabled for the metrics and webhook servers.")
flag.Parse()

// Get the Log level for bpfman deployment where this pod is running
Expand All @@ -81,12 +85,25 @@ func main() {
}
}

disableHTTP2 := func(c *tls.Config) {
if enableHTTP2 {
return
}
c.NextProtos = []string{"http/1.1"}
}

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Scheme: scheme,
Metrics: server.Options{
BindAddress: metricsAddr,
TLSOpts: []func(*tls.Config){disableHTTP2},
},
WebhookServer: webhook.NewServer(webhook.Options{
Port: 9443,
TLSOpts: []func(*tls.Config){disableHTTP2},
}),
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "8730d955.bpfman.io",
Expand Down
2 changes: 1 addition & 1 deletion controllers/bpfman-agent/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ func (r *ReconcilerCommon) updateStatus(ctx context.Context, bpfProgram *bpfmani
meta.SetStatusCondition(&bpfProgram.Status.Conditions, cond.Condition())

r.Logger.V(1).Info("Updating bpfProgram condition", "bpfProgram", bpfProgram.Name, "condition", cond.Condition().Type)
if err := r.Status().Update(ctx, bpfProgram); err != nil {
if err := r.Update(ctx, bpfProgram); err != nil {
r.Logger.Error(err, "failed to set bpfProgram object status")
}

Expand Down
3 changes: 1 addition & 2 deletions controllers/bpfman-agent/fentry-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"
)

//+kubebuilder:rbac:groups=bpfman.io,resources=fentryprograms,verbs=get;list;watch
Expand Down Expand Up @@ -98,7 +97,7 @@ func (r *FentryProgramReconciler) SetupWithManager(mgr ctrl.Manager) error {
// make the FentryProgram no longer select the Node. Additionally only
// care about node events specific to our node
Watches(
&source.Kind{Type: &v1.Node{}},
&v1.Node{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(predicate.And(predicate.LabelChangedPredicate{}, nodePredicate(r.NodeName))),
).
Expand Down
3 changes: 1 addition & 2 deletions controllers/bpfman-agent/fexit-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"
)

//+kubebuilder:rbac:groups=bpfman.io,resources=fexitprograms,verbs=get;list;watch
Expand Down Expand Up @@ -98,7 +97,7 @@ func (r *FexitProgramReconciler) SetupWithManager(mgr ctrl.Manager) error {
// make the FexitProgram no longer select the Node. Additionally only
// care about node events specific to our node
Watches(
&source.Kind{Type: &v1.Node{}},
&v1.Node{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(predicate.And(predicate.LabelChangedPredicate{}, nodePredicate(r.NodeName))),
).
Expand Down
3 changes: 1 addition & 2 deletions controllers/bpfman-agent/kprobe-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"
)

//+kubebuilder:rbac:groups=bpfman.io,resources=kprobeprograms,verbs=get;list;watch
Expand Down Expand Up @@ -98,7 +97,7 @@ func (r *KprobeProgramReconciler) SetupWithManager(mgr ctrl.Manager) error {
// make the KprobeProgram no longer select the Node. Additionally only
// care about node events specific to our node
Watches(
&source.Kind{Type: &v1.Node{}},
&v1.Node{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(predicate.And(predicate.LabelChangedPredicate{}, nodePredicate(r.NodeName))),
).
Expand Down
10 changes: 4 additions & 6 deletions controllers/bpfman-agent/tc-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ import (

"k8s.io/apimachinery/pkg/types"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal"
"github.com/bpfman/bpfman-operator/internal"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal"
"github.com/bpfman/bpfman-operator/internal"

gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -145,7 +143,7 @@ func (r *TcProgramReconciler) SetupWithManager(mgr ctrl.Manager) error {
// make the TcProgram no longer select the Node. Additionally only
// care about events specific to our node
Watches(
&source.Kind{Type: &v1.Node{}},
&v1.Node{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(predicate.And(predicate.LabelChangedPredicate{}, nodePredicate(r.NodeName))),
).
Expand Down
8 changes: 3 additions & 5 deletions controllers/bpfman-agent/tracepoint-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ import (

"k8s.io/apimachinery/pkg/types"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal"

internal "github.com/bpfman/bpfman-operator/internal"
gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1"
Expand Down Expand Up @@ -100,7 +98,7 @@ func (r *TracepointProgramReconciler) SetupWithManager(mgr ctrl.Manager) error {
// make the TracepointProgram no longer select the Node. Additionally only
// care about node events specific to our node
Watches(
&source.Kind{Type: &v1.Node{}},
&v1.Node{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(predicate.And(predicate.LabelChangedPredicate{}, nodePredicate(r.NodeName))),
).
Expand Down
10 changes: 4 additions & 6 deletions controllers/bpfman-agent/uprobe-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ import (

"k8s.io/apimachinery/pkg/types"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal"

internal "github.com/bpfman/bpfman-operator/internal"
gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1"
Expand Down Expand Up @@ -102,13 +100,13 @@ func (r *UprobeProgramReconciler) SetupWithManager(mgr ctrl.Manager) error {
// for when uprobes are attached inside containers. In both cases, only
// care about events specific to our node
Watches(
&source.Kind{Type: &v1.Node{}},
&v1.Node{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(predicate.And(predicate.LabelChangedPredicate{}, nodePredicate(r.NodeName))),
).
// Watch for changes in Pod resources in case we are using a container selector.
Watches(
&source.Kind{Type: &v1.Pod{}},
&v1.Pod{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(podOnNodePredicate(r.NodeName)),
).
Expand Down
10 changes: 4 additions & 6 deletions controllers/bpfman-agent/xdp-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ import (
"context"
"fmt"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal"
internal "github.com/bpfman/bpfman-operator/internal"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal"
internal "github.com/bpfman/bpfman-operator/internal"

gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -129,7 +127,7 @@ func (r *XdpProgramReconciler) SetupWithManager(mgr ctrl.Manager) error {
// make the XdpProgram no longer select the Node. Additionally only
// care about node events specific to our node
Watches(
&source.Kind{Type: &v1.Node{}},
&v1.Node{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(predicate.And(predicate.LabelChangedPredicate{}, nodePredicate(r.NodeName))),
).
Expand Down
2 changes: 1 addition & 1 deletion controllers/bpfman-operator/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (r *ReconcilerCommon) updateCondition(ctx context.Context, obj client.Objec

meta.SetStatusCondition(conditions, cond.Condition(message))

if err := r.Status().Update(ctx, obj); err != nil {
if err := r.Update(ctx, obj); err != nil {
r.Logger.V(1).Info("failed to set *Program object status...requeuing")
return ctrl.Result{Requeue: true, RequeueAfter: retryDurationOperator}, nil
}
Expand Down
8 changes: 3 additions & 5 deletions controllers/bpfman-operator/fentry-program.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/builder"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
"github.com/bpfman/bpfman-operator/internal"
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/source"

bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1"
"github.com/bpfman/bpfman-operator/internal"
)

//+kubebuilder:rbac:groups=bpfman.io,resources=fentryprograms,verbs=get;list;watch;create;update;patch;delete
Expand All @@ -55,7 +53,7 @@ func (r *FentryProgramReconciler) SetupWithManager(mgr ctrl.Manager) error {
For(&bpfmaniov1alpha1.FentryProgram{}).
// Watch bpfPrograms which are owned by FentryPrograms
Watches(
&source.Kind{Type: &bpfmaniov1alpha1.BpfProgram{}},
&bpfmaniov1alpha1.BpfProgram{},
&handler.EnqueueRequestForObject{},
builder.WithPredicates(predicate.And(statusChangedPredicate(), internal.BpfProgramTypePredicate(internal.FentryString))),
).
Expand Down
Loading

0 comments on commit 8c60b32

Please sign in to comment.