Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankagg9722 committed Apr 2, 2024
2 parents b371e82 + d1541d2 commit 2e35f30
Show file tree
Hide file tree
Showing 62 changed files with 6,691 additions and 2,478 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.137.0/containers/go/.devcontainer/base.Dockerfile
# See here for image contents: https://github.com/devcontainers/images/blob/main/src/go/.devcontainer/Dockerfile

# This is pinned to a particular version of go:
FROM mcr.microsoft.com/vscode/devcontainers/go:0-1.20
FROM mcr.microsoft.com/devcontainers/go:1.22

# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETARCH
Expand Down
14 changes: 7 additions & 7 deletions .devcontainer/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fi

# Ensure we have the right version of GO

#doc# | Go | 1.20 | https://golang.org/doc/install #
#doc# | Go | 1.22 | https://golang.org/doc/install #
if ! command -v go > /dev/null 2>&1; then
write-error "Go must be installed manually; see https://golang.org/doc/install"
exit 1
Expand All @@ -104,7 +104,7 @@ GOVER=$(go version)
write-info "Go version: ${GOVER[*]}"

GOVERREGEX=".*go1.([0-9]+).([0-9]+).*"
GOVERREQUIRED="go1.20.*"
GOVERREQUIRED="go1.22.*"
GOVERACTUAL=$(go version | { read _ _ ver _; echo "$ver"; })

if ! [[ $GOVERACTUAL =~ $GOVERREGEX ]]; then
Expand All @@ -113,7 +113,7 @@ if ! [[ $GOVERACTUAL =~ $GOVERREGEX ]]; then
fi

GOMINORVER="${BASH_REMATCH[1]}"
GOMINORREQUIRED=20
GOMINORREQUIRED=22

# We allow for Go versions above the min version, but prevent versions below. This is safe given Go's back-compat guarantees
if ! [[ $GOMINORVER -ge $GOMINORREQUIRED ]]; then
Expand Down Expand Up @@ -179,11 +179,11 @@ go-install() {
fi
}

#doc# | conversion-gen | v0.28.0 | https://pkg.go.dev/k8s.io/code-generator/cmd/conversion-gen |
go-install conversion-gen k8s.io/code-generator/cmd/conversion-gen@v0.28.0
#doc# | conversion-gen | v0.28.8 | https://pkg.go.dev/k8s.io/code-generator/cmd/conversion-gen |
go-install conversion-gen k8s.io/code-generator/cmd/conversion-gen@v0.28.8

#doc# | controller-gen | v0.13.0 | https://book.kubebuilder.io/reference/controller-gen |
go-install controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0
#doc# | controller-gen | v0.14.0 | https://book.kubebuilder.io/reference/controller-gen |
go-install controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0

#doc# | kind | v0.20.0 | https://kind.sigs.k8s.io/ |
go-install kind sigs.k8s.io/kind@v0.20.0
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,20 @@ jobs:
if-no-files-found: error
if: steps.check-changes.outputs.code-changed == 'true'

# Workaround for getting "Permission denied" errors when trying to perform code coverage upload
- name: Take Ownership
run: sudo chown -R $USER:$USER .

# We were using bash upload previously, but it's unsupported since 2022 and
# seems to hang forever now. There seems to be significant throttling of tokenless requests (from forks)
# errors like: Upload failed: {"detail":"Tokenless has reached GitHub rate limit. Please upload using a token:
# https://docs.codecov.com/docs/adding-the-codecov-token. Expected available in 395 seconds."}
# Unfortunately I don't see another choice for this so for now we'll live with it
- name: Upload code coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
if: steps.check-changes.outputs.code-changed == 'true'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

# TODO: Changing this name requires changing the github API calls in pr-validation-fork.yml
integration-tests:
Expand Down
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.20 as builder
FROM golang:1.22 as builder

# need jq for running the Makefile
RUN curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 && chmod +x /usr/local/bin/jq
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ install-tools:
go install github.com/mikefarah/yq/v4@v4.23.1
go install k8s.io/code-generator/cmd/conversion-gen@v0.23.5
go install sigs.k8s.io/kustomize/kustomize/v4@v4.5.4
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0
CONTROLLER_GEN=$(shell go env GOPATH)/bin/controller-gen

# Operator-sdk release version
Expand Down
6 changes: 3 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ tasks:
desc: Ensure all code is formatted
dir: v2
cmds:
- gofumpt -l -s -w .
- gofumpt -l -w .

build-docs-site:
cmds:
Expand Down Expand Up @@ -620,7 +620,7 @@ tasks:
- if [ -d "{{.CONTROLLER_OUTPUT}}/crd/generated/patches" ]; then find "{{.CONTROLLER_OUTPUT}}/crd/generated/patches" -type f -delete; fi
- cd v2/api && controller-gen {{.OBJECT_OPTIONS}} paths=./...
- cd v2/api && controller-gen {{.CRD_OPTIONS}} {{.WEBHOOK_OPTIONS}} {{.RBAC_OPTIONS}} paths=./...
- cd v2/api && gofumpt -l -s -w . # format all generated code
- cd v2/api && gofumpt -l -w . # format all generated code
vars:
OBJECT_OPTIONS: object:headerFile={{.HEADER_FILE}}
CRD_OPTIONS: crd:crdVersions=v1,allowDangerousTypes=true output:crd:artifacts:config={{.CONTROLLER_OUTPUT}}/crd/generated/bases
Expand Down Expand Up @@ -1040,7 +1040,7 @@ tasks:
- if [ -d "{{.CROSSPLANE_OUTPUT}}/crd/patches" ]; then find "{{.CROSSPLANE_OUTPUT}}/crd/patches" -type f -delete; fi
- cd apis && controller-gen {{.OBJECT_OPTIONS}} paths=./...
- cd apis && controller-gen {{.CRD_OPTIONS}} {{.WEBHOOK_OPTIONS}} {{.RBAC_OPTIONS}} paths=./...
- cd apis && gofumpt -l -s -w . # format all generated code
- cd apis && gofumpt -l -w . # format all generated code
vars:
OBJECT_OPTIONS: object:headerFile={{.HEADER_FILE}}
CRD_OPTIONS: crd:crdVersions=v1,allowDangerousTypes=true output:crd:artifacts:config={{.CROSSPLANE_OUTPUT}}/crd/bases
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
displayName: 'Validate Source'
continueOnError: 'false'
# TODO: Tried to update to Go 1.22 but failed, see https://github.com/microsoft/azure-pipelines-tasks/issues/19690
- task: GoTool@0
displayName: Get Go 1.20
condition: or(eq(variables['check_changes.SOURCE_CODE_CHANGED'], 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
Expand Down
5 changes: 4 additions & 1 deletion controllers/apimgmt_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import (
"os"
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
"github.com/Azure/azure-service-operator/pkg/helpers"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestAPIMgmtController(t *testing.T) {
t.Skip("takes too long")

t.Parallel()
defer PanicRecover(t)
ctx := context.Background()
Expand Down
4 changes: 2 additions & 2 deletions controllers/azuresql_combined_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAzureSqlServerCombinedHappyPath(t *testing.T) {
// Add any setup steps that needs to be executed before each test
rgName := tc.resourceGroupName
sqlServerName := GenerateTestResourceNameWithRandom("sqlserver", 10)
rgLocation := "westus3"
rgLocation := "eastus"
rgLocation2 := "southcentralus"
sqlServerTwoName := GenerateTestResourceNameWithRandom("sqlserver-two", 10)

Expand Down Expand Up @@ -342,7 +342,7 @@ func TestAzureSqlServer_KeyVaultSoftDelete_CreateDeleteCreateAgain(t *testing.T)
ctx := context.Background()
require := require.New(t)

rgLocation := "westus3"
rgLocation := "eastus"

// Create a KeyVault with soft delete enabled that we can use to perform our tests
keyVaultName := GenerateAlphaNumTestResourceNameWithRandom("kvsoftdel", 5)
Expand Down
9 changes: 4 additions & 5 deletions controllers/blobcontainer_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ import (

s "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage"
"github.com/Azure/go-autorest/autorest/to"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/Azure/azure-service-operator/api/v1alpha1"
"github.com/Azure/azure-service-operator/api/v1alpha2"
"github.com/Azure/azure-service-operator/pkg/errhelp"
helpers "github.com/Azure/azure-service-operator/pkg/helpers"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/Azure/azure-service-operator/pkg/helpers"
)

func TestBlobContainerControlleNoResourceGroup(t *testing.T) {
func TestBlobContainerControllerNoResourceGroup(t *testing.T) {
t.Parallel()
defer PanicRecover(t)
ctx := context.Background()
Expand All @@ -33,7 +32,7 @@ func TestBlobContainerControlleNoResourceGroup(t *testing.T) {
// Add any setup steps that needs to be executed before each test
rgLocation = tc.resourceGroupLocation
saName = GenerateAlphaNumTestResourceName("blobsa")
containerAccessLevel = s.PublicAccessContainer
containerAccessLevel = s.PublicAccessNone

blobContainerName := GenerateTestResourceNameWithRandom("bc", 10)
resourceGroupName := GenerateTestResourceNameWithRandom("rg", 10)
Expand Down
2 changes: 1 addition & 1 deletion controllers/cosmosdb_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestCosmosDBHappyPath(t *testing.T) {
Namespace: namespace,
},
Spec: v1alpha1.CosmosDBSpec{
Location: "westus3", // WestUS2 is currently full // tc.resourceGroupLocation,
Location: "eastus", // WestUS2 is currently full // tc.resourceGroupLocation,
ResourceGroup: tc.resourceGroupName,
Kind: v1alpha1.CosmosDBKindGlobalDocumentDB,
Properties: v1alpha1.CosmosDBProperties{
Expand Down
2 changes: 1 addition & 1 deletion controllers/eventhub_storageaccount_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func TestEventHubCapture_StorageAccountAndBlob_Controllers(t *testing.T) {
saName := GenerateAlphaNumTestResourceName("ehsa")
bcName := GenerateTestResourceNameWithRandom("ehblob", 10)
eventHubName := GenerateTestResourceNameWithRandom("eh-capture", 10)
containerAccessLevel := s.PublicAccessContainer
containerAccessLevel := s.PublicAccessNone

// Create Eventhub namespace
eventhubNamespaceInstance := &azurev1alpha1.EventhubNamespace{
Expand Down
6 changes: 6 additions & 0 deletions controllers/mysql_combined_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
)

func TestMySQLHappyPath(t *testing.T) {
t.Skip("MySQL Single Server is now deprecated")

t.Parallel()
defer PanicRecover(t)
ctx := context.Background()
Expand Down Expand Up @@ -204,6 +206,8 @@ func RunMySQLUserHappyPath(ctx context.Context, t *testing.T, mySQLServerName st
}

func TestMySQLUserSuppliedPassword(t *testing.T) {
t.Skip("MySQL Single Server is now deprecated")

t.Parallel()
defer PanicRecover(t)
ctx := context.Background()
Expand Down Expand Up @@ -275,6 +279,8 @@ func TestMySQLUserSuppliedPassword(t *testing.T) {
}

func TestMySQLServerSecretRollover(t *testing.T) {
t.Skip("MySQL Single Server is now deprecated")

t.Parallel()
defer PanicRecover(t)
ctx := context.Background()
Expand Down
4 changes: 2 additions & 2 deletions controllers/secret_naming_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestAzureSqlServerAndUser_SecretNamedCorrectly(t *testing.T) {
// Add any setup steps that needs to be executed before each test
rgName := tc.resourceGroupName
sqlServerName := GenerateTestResourceNameWithRandom("sqlserver1", 10)
rgLocation := "westus3"
rgLocation := "eastus"

sqlServerNamespacedName := types.NamespacedName{Name: sqlServerName, Namespace: "default"}
sqlServerInstance := v1beta1.NewAzureSQLServer(sqlServerNamespacedName, rgName, rgLocation)
Expand Down Expand Up @@ -462,7 +462,7 @@ func TestAzureSqlServerKVSecretAndUser_SecretNamedCorrectly(t *testing.T) {
// Add any setup steps that needs to be executed before each test
rgName := tc.resourceGroupName
sqlServerName := GenerateTestResourceNameWithRandom("kvsqlserv", 10)
rgLocation := "westus3"
rgLocation := "eastus"

sqlServerNamespacedName := types.NamespacedName{Name: sqlServerName, Namespace: "default"}
sqlServerInstance := v1beta1.NewAzureSQLServer(sqlServerNamespacedName, rgName, rgLocation)
Expand Down
2 changes: 1 addition & 1 deletion docs/hugo/content/contributing/aso-codegen-structure.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/hugo/content/contributing/aso-v1-structure.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/hugo/content/contributing/aso-v2-structure.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/hugo/content/contributing/asoctl-structure.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/hugo/content/contributing/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ If you prefer to install those dependencies manually (instead of using the `.dev
| AZWI | v1.2.0 | https://github.com/Azure/azure-workload-identity |
| BuildX | v0.11.2 | https://github.com/docker/buildx |
| cmctl | latest | https://cert-manager.io/docs/reference/cmctl |
| controller-gen | v0.13.0 | https://book.kubebuilder.io/reference/controller-gen |
| conversion-gen | v0.28.0 | https://pkg.go.dev/k8s.io/code-generator/cmd/conversion-gen |
| controller-gen | v0.14.0 | https://book.kubebuilder.io/reference/controller-gen |
| conversion-gen | v0.28.8 | https://pkg.go.dev/k8s.io/code-generator/cmd/conversion-gen |
| gen-crd-api-reference-docs | 11fe95cb | https://github.com/ahmetb/gen-crd-api-reference-docs |
| Go | 1.20 | https://golang.org/doc/install #
| Go | 1.22 | https://golang.org/doc/install #
| gofumpt | latest | https://pkg.go.dev/mvdan.cc/gofumpt |
| golangci-lint | 1.51.2 | https://github.com/golangci/golangci-lint |
| Helm | v3.8.0 | https://helm.sh/ |
Expand Down
14 changes: 7 additions & 7 deletions docs/hugo/content/reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,13 @@ To install the CRDs for these resources, your ASO configuration must include `ev

These resource(s) are available for use in the current release of ASO. Different versions of a given resource reflect different versions of the Azure ARM API.

| Resource | ARM Version | CRD Version | Supported From | Sample |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|---------------|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| [Namespace](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.Namespace) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api/v1api20211101_namespace.yaml) |
| [NamespacesAuthorizationRule](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.NamespacesAuthorizationRule) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api/v1api20211101_namespacesauthorizationrule.yaml) |
| [NamespacesEventhub](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.NamespacesEventhub) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api/v1api20211101_namespaceseventhub.yaml) |
| [NamespacesEventhubsAuthorizationRule](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.NamespacesEventhubsAuthorizationRule) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api/v1api20211101_namespaceseventhubsauthorizationrule.yaml) |
| [NamespacesEventhubsConsumerGroup](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.NamespacesEventhubsConsumerGroup) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api/v1api20211101_namespaceseventhubsconsumergroup.yaml) |
| Resource | ARM Version | CRD Version | Supported From | Sample |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|---------------|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Namespace](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.Namespace) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api20211101/v1api20211101_namespace.yaml) |
| [NamespacesAuthorizationRule](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.NamespacesAuthorizationRule) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api20211101/v1api20211101_namespacesauthorizationrule.yaml) |
| [NamespacesEventhub](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.NamespacesEventhub) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api20211101/v1api20211101_namespaceseventhub.yaml) |
| [NamespacesEventhubsAuthorizationRule](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.NamespacesEventhubsAuthorizationRule) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api20211101/v1api20211101_namespaceseventhubsauthorizationrule.yaml) |
| [NamespacesEventhubsConsumerGroup](https://azure.github.io/azure-service-operator/reference/eventhub/v1api20211101/#eventhub.azure.com/v1api20211101.NamespacesEventhubsConsumerGroup) | 2021-11-01 | v1api20211101 | v2.0.0 | [View](https://github.com/Azure/azure-service-operator/tree/main/v2/samples/eventhub/v1api20211101/v1api20211101_namespaceseventhubsconsumergroup.yaml) |

## Insights

Expand Down
Loading

0 comments on commit 2e35f30

Please sign in to comment.