Skip to content

Commit

Permalink
Merge branch 'master' into feature/lint-disclosures
Browse files Browse the repository at this point in the history
  • Loading branch information
theunrepentantgeek authored Jul 15, 2021
2 parents 4dca5a9 + 02973a1 commit da1d489
Show file tree
Hide file tree
Showing 104 changed files with 1,659 additions and 545 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.13.7 as builder
FROM golang:1.16 as builder

WORKDIR /workspace/
# Copy the Go Modules manifests
Expand Down
6 changes: 5 additions & 1 deletion api/v1alpha1/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ func TestAPIs(t *testing.T) {
}

var _ = BeforeSuite(func(done Done) {
logf.SetLogger(zap.LoggerTo(GinkgoWriter, true))
zaplogger := zap.New(func(o *zap.Options) {
o.DestWriter = GinkgoWriter
o.Development = true
})
logf.SetLogger(zaplogger)

By("bootstrapping test environment")
testEnv = &envtest.Environment{
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ steps:
- task: GoTool@0
displayName: Get Go 1.13.7
displayName: Get Go 1.16
condition: or(eq(variables['check_changes.SOURCE_CODE_CHANGED'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
version: '1.13.7'
version: '1.16'

- task: Go@0
displayName: Get Go dependencies
Expand Down
10 changes: 8 additions & 2 deletions controllers/apimgmt_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@ package controllers

import (
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"

"context"

ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
)

// APIMAPIReconciler reconciles a APIM object
type APIMAPIReconciler struct {
Reconciler *AsyncReconciler
}

var _ reconcile.Reconciler = &APIMAPIReconciler{}

// +kubebuilder:rbac:groups=azure.microsoft.com,resources=apimgmtapis,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={apimgmtapis/status,apimgmtapis/finalizers},verbs=get;update;patch

// Reconcile attempts to set the desired state snapshot representation of the service in k8s
func (r *APIMAPIReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.APIMgmtAPI{})
func (r *APIMAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.APIMgmtAPI{})
}

// SetupWithManager initializes the control loop for this operator
Expand Down
6 changes: 4 additions & 2 deletions controllers/apimservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -18,8 +20,8 @@ type ApimServiceReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={apimservices/status,apimservices/finalizers},verbs=get;update;patch

// Reconcile function does the main reconciliation loop of the operator
func (r *ApimServiceReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.ApimService{})
func (r *ApimServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.ApimService{})
}

// SetupWithManager function sets up the functions with the controller
Expand Down
7 changes: 5 additions & 2 deletions controllers/appinsights_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ package controllers

import (
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"

"context"

ctrl "sigs.k8s.io/controller-runtime"
)

Expand All @@ -17,8 +20,8 @@ type AppInsightsReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={appinsights/status,appinsights/finalizers},verbs=get;update;patch

// Reconcile attempts to set the desired state snapshot representation of the service in k8s
func (r *AppInsightsReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AppInsights{})
func (r *AppInsightsReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AppInsights{})
}

// SetupWithManager initializes the control loop for this operator
Expand Down
6 changes: 4 additions & 2 deletions controllers/appinsightsapikey_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -17,8 +19,8 @@ type AppInsightsApiKeyReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=appinsightsapikeys,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={appinsightsapikeys/status,appinsightsapikeys/finalizers},verbs=get;update;patch

func (r *AppInsightsApiKeyReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AppInsightsApiKey{})
func (r *AppInsightsApiKeyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AppInsightsApiKey{})
}

func (r *AppInsightsApiKeyReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
17 changes: 9 additions & 8 deletions controllers/async_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-service-operator/pkg/resourcemanager"
"github.com/Azure/azure-service-operator/pkg/resourcemanager/config"
"github.com/Azure/azure-service-operator/pkg/secrets"
keyvaultsecretlib "github.com/Azure/azure-service-operator/pkg/secrets/keyvault"
telemetry "github.com/Azure/azure-service-operator/pkg/telemetry"
multierror "github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-multierror"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -23,6 +18,12 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"

"github.com/Azure/azure-service-operator/pkg/resourcemanager"
"github.com/Azure/azure-service-operator/pkg/resourcemanager/config"
"github.com/Azure/azure-service-operator/pkg/secrets"
keyvaultsecretlib "github.com/Azure/azure-service-operator/pkg/secrets/keyvault"
"github.com/Azure/azure-service-operator/pkg/telemetry"
)

const (
Expand All @@ -44,8 +45,8 @@ type AsyncReconciler struct {
}

// Reconcile reconciles the change request
func (r *AsyncReconciler) Reconcile(req ctrl.Request, obj runtime.Object) (result ctrl.Result, err error) {
ctx, cancel := context.WithTimeout(context.Background(), reconcileTimeout)
func (r *AsyncReconciler) Reconcile(ctx context.Context, req ctrl.Request, obj client.Object) (result ctrl.Result, err error) {
ctx, cancel := context.WithTimeout(ctx, reconcileTimeout)
defer cancel()

if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
Expand Down
6 changes: 4 additions & 2 deletions controllers/azureloadbalancer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -17,8 +19,8 @@ type AzureLoadBalancerReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=azureloadbalancers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azureloadbalancers/status,azureloadbalancers/finalizers},verbs=get;update;patch

func (r *AzureLoadBalancerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AzureLoadBalancer{})
func (r *AzureLoadBalancerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AzureLoadBalancer{})
}

func (r *AzureLoadBalancerReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
6 changes: 4 additions & 2 deletions controllers/azurenetworkinterface_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -17,8 +19,8 @@ type AzureNetworkInterfaceReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=azurenetworkinterfaces,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azurenetworkinterfaces/status,azurenetworkinterfaces/finalizers},verbs=get;update;patch

func (r *AzureNetworkInterfaceReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AzureNetworkInterface{})
func (r *AzureNetworkInterfaceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AzureNetworkInterface{})
}

func (r *AzureNetworkInterfaceReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
6 changes: 4 additions & 2 deletions controllers/azurepublicipaddress_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -17,8 +19,8 @@ type AzurePublicIPAddressReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=azurepublicipaddresses,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azurepublicipaddresses/status,azurepublicipaddresses/finalizers},verbs=get;update;patch

func (r *AzurePublicIPAddressReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AzurePublicIPAddress{})
func (r *AzurePublicIPAddressReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AzurePublicIPAddress{})
}

func (r *AzurePublicIPAddressReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
7 changes: 5 additions & 2 deletions controllers/azuresqlaction_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ package controllers

import (
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"

"context"

ctrl "sigs.k8s.io/controller-runtime"
)

Expand All @@ -17,8 +20,8 @@ type AzureSqlActionReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azuresqlactions/status,azuresqlactions/finalizers},verbs=get;update;patch

// Reconcile function runs the actual reconcilation loop of the controller
func (r *AzureSqlActionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AzureSqlAction{})
func (r *AzureSqlActionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AzureSqlAction{})
}

func (r *AzureSqlActionReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
7 changes: 5 additions & 2 deletions controllers/azuresqldatabase_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ package controllers

import (
"github.com/Azure/azure-service-operator/api/v1beta1"

"context"

ctrl "sigs.k8s.io/controller-runtime"
)

Expand All @@ -17,8 +20,8 @@ type AzureSqlDatabaseReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azuresqldatabases/status,azuresqldatabases/finalizers},verbs=get;update;patch

// Reconcile function does the main reconciliation loop of the operator
func (r *AzureSqlDatabaseReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &v1beta1.AzureSqlDatabase{})
func (r *AzureSqlDatabaseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &v1beta1.AzureSqlDatabase{})
}

// SetupWithManager function sets up the functions with the controller
Expand Down
7 changes: 5 additions & 2 deletions controllers/azuresqlfailovergroup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ package controllers

import (
"github.com/Azure/azure-service-operator/api/v1beta1"

"context"

ctrl "sigs.k8s.io/controller-runtime"
)

Expand All @@ -17,8 +20,8 @@ type AzureSqlFailoverGroupReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azuresqlfailovergroups/status,azuresqlfailovergroups/finalizers},verbs=get;update;patch

// Reconcile function does the main reconciliation loop of the operator
func (r *AzureSqlFailoverGroupReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &v1beta1.AzureSqlFailoverGroup{})
func (r *AzureSqlFailoverGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &v1beta1.AzureSqlFailoverGroup{})
}

func (r *AzureSqlFailoverGroupReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
6 changes: 4 additions & 2 deletions controllers/azuresqlfirewallrule_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

"github.com/Azure/azure-service-operator/api/v1beta1"
Expand All @@ -18,8 +20,8 @@ type AzureSqlFirewallRuleReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azuresqlfirewallrules/status,azuresqlfirewallrules/finalizers},verbs=get;update;patch

// Reconcile function does the main reconciliation loop of the operator
func (r *AzureSqlFirewallRuleReconciler) Reconcile(req ctrl.Request) (result ctrl.Result, err error) {
return r.Reconciler.Reconcile(req, &v1beta1.AzureSqlFirewallRule{})
func (r *AzureSqlFirewallRuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, err error) {
return r.Reconciler.Reconcile(ctx, req, &v1beta1.AzureSqlFirewallRule{})
}

// SetupWithManager function sets up the functions with the controller
Expand Down
6 changes: 4 additions & 2 deletions controllers/azuresqlmanageduser_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -17,8 +19,8 @@ type AzureSQLManagedUserReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=azuresqlmanagedusers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azuresqlmanagedusers/status,azuresqlmanagedusers/finalizers},verbs=get;update;patch

func (r *AzureSQLManagedUserReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AzureSQLManagedUser{})
func (r *AzureSQLManagedUserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AzureSQLManagedUser{})
}

func (r *AzureSQLManagedUserReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
6 changes: 4 additions & 2 deletions controllers/azuresqlserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

"github.com/Azure/azure-service-operator/api/v1beta1"
Expand All @@ -17,8 +19,8 @@ type AzureSqlServerReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=azuresqlservers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azuresqlservers/status,azuresqlservers/finalizers},verbs=get;update;patch

func (r *AzureSqlServerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &v1beta1.AzureSqlServer{})
func (r *AzureSqlServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &v1beta1.AzureSqlServer{})
}

func (r *AzureSqlServerReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
6 changes: 4 additions & 2 deletions controllers/azuresqluser_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -17,8 +19,8 @@ type AzureSQLUserReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=azuresqlusers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azuresqlusers/status,azuresqlusers/finalizers},verbs=get;update;patch

func (r *AzureSQLUserReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AzureSQLUser{})
func (r *AzureSQLUserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AzureSQLUser{})
}

// SetupWithManager runs reconcile loop with manager
Expand Down
6 changes: 4 additions & 2 deletions controllers/azuresqlvnetrule_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package controllers

import (
"context"

ctrl "sigs.k8s.io/controller-runtime"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -17,8 +19,8 @@ type AzureSQLVNetRuleReconciler struct {
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=azuresqlvnetrules,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources={azuresqlvnetrules/status,azuresqlvnetrules/finalizers},verbs=get;update;patch

func (r *AzureSQLVNetRuleReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(req, &azurev1alpha1.AzureSQLVNetRule{})
func (r *AzureSQLVNetRuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
return r.Reconciler.Reconcile(ctx, req, &azurev1alpha1.AzureSQLVNetRule{})
}

func (r *AzureSQLVNetRuleReconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
Loading

0 comments on commit da1d489

Please sign in to comment.