Skip to content

Commit

Permalink
Merge pull request #17 from mhenriks/deps-update
Browse files Browse the repository at this point in the history
update k8s deps and controller runtime
  • Loading branch information
Jakub Dzon authored Jun 7, 2021
2 parents bbf1616 + 1adda9b commit 458ab0e
Show file tree
Hide file tree
Showing 2,827 changed files with 255,634 additions and 192,711 deletions.
2 changes: 1 addition & 1 deletion examples/sample-operator/build/operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.13 AS builder
FROM golang:1.14 AS builder
WORKDIR /src/sample-operator/
COPY . .
ENV GOFLAGS=-mod=vendor
Expand Down
10 changes: 5 additions & 5 deletions examples/sample-operator/cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import (

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/client-go/rest"

"kubevirt.io/controller-lifecycle-operator-sdk/examples/sample-operator/pkg/apis"
"kubevirt.io/controller-lifecycle-operator-sdk/examples/sample-operator/pkg/controller"
"kubevirt.io/controller-lifecycle-operator-sdk/examples/sample-operator/version"

"github.com/operator-framework/operator-sdk/pkg/k8sutil"
kubemetrics "github.com/operator-framework/operator-sdk/pkg/kube-metrics"
Expand All @@ -25,10 +20,15 @@ import (
"github.com/spf13/pflag"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client/config"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"

"kubevirt.io/controller-lifecycle-operator-sdk/examples/sample-operator/pkg/apis"
"kubevirt.io/controller-lifecycle-operator-sdk/examples/sample-operator/pkg/controller"
"kubevirt.io/controller-lifecycle-operator-sdk/examples/sample-operator/version"
)

// Change below variables to serve metrics on different host or port.
Expand Down
22 changes: 13 additions & 9 deletions examples/sample-operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,28 @@ go 1.13

require (
github.com/kelseyhightower/envconfig v1.4.0
github.com/onsi/ginkgo v1.12.1
github.com/onsi/gomega v1.10.1
github.com/onsi/ginkgo v1.15.0
github.com/onsi/gomega v1.10.5
github.com/operator-framework/operator-sdk v0.18.0
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
golang.org/x/tools v0.0.0-20200616195046-dc31b401abb5
k8s.io/api v0.18.6
k8s.io/apimachinery v0.18.6
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e
k8s.io/api v0.20.2
k8s.io/apimachinery v0.20.2
k8s.io/client-go v12.0.0+incompatible
k8s.io/code-generator v0.18.6
k8s.io/code-generator v0.20.2
kubevirt.io/client-go v0.32.0
kubevirt.io/controller-lifecycle-operator-sdk v0.0.7
sigs.k8s.io/controller-runtime v0.6.2
sigs.k8s.io/controller-runtime v0.8.3
)

replace k8s.io/client-go => k8s.io/client-go v0.18.6
replace k8s.io/client-go => k8s.io/client-go v0.20.2

replace github.com/Azure/go-autorest => github.com/Azure/go-autorest v13.3.2+incompatible // Required by O
replace k8s.io/api => k8s.io/api v0.20.2

replace k8s.io/cli-runtime => k8s.io/cli-runtime v0.20.2

replace k8s.io/kubectl => k8s.io/kubectl v0.20.2

replace vbom.ml/util => github.com/fvbommel/util v0.0.0-20180919145318-efcd4e0f9787

Expand Down
338 changes: 286 additions & 52 deletions examples/sample-operator/go.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sampleconfig

import (
"context"
"fmt"

"kubevirt.io/client-go/util"
Expand Down Expand Up @@ -135,7 +136,7 @@ type ReconcileSampleConfig struct {

// Reconcile reads that state of the cluster for a SampleConfig object and makes changes based on the state read
// and what is in the SampleConfig.Spec
func (r *ReconcileSampleConfig) Reconcile(request reconcile.Request) (reconcile.Result, error) {
func (r *ReconcileSampleConfig) Reconcile(_ context.Context, request reconcile.Request) (reconcile.Result, error) {
reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name)
reqLogger.Info("Reconciling SampleConfig")
return r.reconciler.Reconcile(request, r.operatorArgs.OperatorVersion, reqLogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"
"sigs.k8s.io/controller-runtime/pkg/client"

"kubevirt.io/controller-lifecycle-operator-sdk/examples/sample-operator/pkg/apis/sample/v1alpha1"
sdkapi "kubevirt.io/controller-lifecycle-operator-sdk/pkg/sdk/api"
"kubevirt.io/controller-lifecycle-operator-sdk/pkg/sdk/resources"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
)

const (
Expand Down Expand Up @@ -38,23 +38,23 @@ type CrManager struct {
}

// IsCreating checks whether creation of the managed resources will be executed
func (m *CrManager) IsCreating(cr controllerutil.Object) (bool, error) {
func (m *CrManager) IsCreating(cr client.Object) (bool, error) {
config := cr.(*v1alpha1.SampleConfig)
return config.Status.Conditions == nil || len(config.Status.Conditions) == 0, nil
}

// Create creates empty CR
func (m *CrManager) Create() controllerutil.Object {
func (m *CrManager) Create() client.Object {
return new(v1alpha1.SampleConfig)
}

// Status extracts status from the cr
func (m *CrManager) Status(cr runtime.Object) *sdkapi.Status {
func (m *CrManager) Status(cr client.Object) *sdkapi.Status {
return &cr.(*v1alpha1.SampleConfig).Status.Status
}

// GetAllResources provides all resources managed by the cr
func (m *CrManager) GetAllResources(obj runtime.Object) ([]runtime.Object, error) {
func (m *CrManager) GetAllResources(obj client.Object) ([]client.Object, error) {
namespace := m.operatorArgs.Namespace

serviceAccount := resourceBuilder.CreateServiceAccount(HTTPServerName)
Expand All @@ -70,7 +70,7 @@ func (m *CrManager) GetAllResources(obj runtime.Object) ([]runtime.Object, error
httpDeployment := m.createHTTPServerDeployment(&cr.Spec.Infra)
httpService := m.createHTTPServerService()

return []runtime.Object{
return []client.Object{
serviceAccount,
role,
roleBinding,
Expand Down Expand Up @@ -107,8 +107,8 @@ func (m *CrManager) createHTTPServerDeployment(placement *sdkapi.NodePlacement)
}

// GetDependantResourcesListObjects returns resource list objects of dependant resources
func (m *CrManager) GetDependantResourcesListObjects() []runtime.Object {
return []runtime.Object{
func (m *CrManager) GetDependantResourcesListObjects() []client.ObjectList {
return []client.ObjectList{
&appsv1.DeploymentList{},
&v1.ServiceList{},
&v1.ServiceAccountList{},
Expand Down

This file was deleted.

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

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

Loading

0 comments on commit 458ab0e

Please sign in to comment.