Skip to content

Commit

Permalink
Merge pull request #9 from lobziik/rebase-07-22-2021
Browse files Browse the repository at this point in the history
Rebase 07 22 2021
  • Loading branch information
openshift-merge-robot committed Jul 23, 2021
2 parents 293fcea + 13adee1 commit 799f060
Show file tree
Hide file tree
Showing 325 changed files with 114,418 additions and 1,919 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.61.0"
hugo-version: "0.84.0"
extended: true

- name: Build
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test Coverage
on:
pull_request: {}
push: {}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Build Test
run: sudo go test -covermode=count -coverprofile=profile.cov ./pkg/...
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GO111MODULE=off go get github.com/mattn/goveralls
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github
29 changes: 29 additions & 0 deletions .github/workflows/test-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test Docs

on:
pull_request: {}
push: {}

jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.84.0"
extended: true

- name: Build Docs
run: |
cd site
npm install postcss-cli
npm install autoprefixer
npm audit fix
hugo --minify
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ linters:
- errcheck
# - errorlint
- goconst
- gocyclo
# - gocyclo
- gofmt
- goimports
- golint
Expand Down
85 changes: 45 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,153 +59,158 @@ CCM_E2E_TEST_IMAGE=$(IMAGE_REGISTRY)/$(CCM_E2E_TEST_IMAGE_NAME):$(IMAGE_TAG)
CCM_E2E_TEST_RELEASE_IMAGE=docker.pkg.github.com/kubernetes-sigs/cloud-provider-azure/cloud-provider-azure-e2e:$(IMAGE_TAG)


##@ General

help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[.a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

## --------------------------------------
## Binaries
##@ Binaries
## --------------------------------------

.PHONY: all
all: $(BIN_DIR)/azure-cloud-controller-manager $(BIN_DIR)/azure-cloud-node-manager $(BIN_DIR)/azure-cloud-node-manager.exe
all: $(BIN_DIR)/azure-cloud-controller-manager $(BIN_DIR)/azure-cloud-node-manager $(BIN_DIR)/azure-cloud-node-manager.exe ## Build binaries for the project.

$(BIN_DIR)/azure-cloud-node-manager: $(PKG_CONFIG) $(wildcard cmd/cloud-node-manager/*) $(wildcard cmd/cloud-node-manager/**/*) $(wildcard pkg/**/*)
CGO_ENABLED=0 GOOS=linux go build -a -o $@ $(PKG_CONFIG_CONTENT) ./cmd/cloud-node-manager
$(BIN_DIR)/azure-cloud-node-manager: $(PKG_CONFIG) $(wildcard cmd/cloud-node-manager/*) $(wildcard cmd/cloud-node-manager/**/*) $(wildcard pkg/**/*) ## Build node-manager binary for Linux.
CGO_ENABLED=0 GOOS=linux go build -a -o $(BIN_DIR)/azure-cloud-node-manager $(PKG_CONFIG_CONTENT) ./cmd/cloud-node-manager

$(BIN_DIR)/azure-cloud-node-manager.exe: $(PKG_CONFIG) $(wildcard cmd/cloud-node-manager/*) $(wildcard cmd/cloud-node-manager/**/*) $(wildcard pkg/**/*)
CGO_ENABLED=0 GOOS=windows go build -a -o $@ $(PKG_CONFIG_CONTENT) ./cmd/cloud-node-manager
$(BIN_DIR)/azure-cloud-node-manager.exe: $(PKG_CONFIG) $(wildcard cmd/cloud-node-manager/*) $(wildcard cmd/cloud-node-manager/**/*) $(wildcard pkg/**/*) ## Build node-manager binary for Windows.
CGO_ENABLED=0 GOOS=windows go build -a -o $(BIN_DIR)/azure-cloud-node-manager.exe $(PKG_CONFIG_CONTENT) ./cmd/cloud-node-manager

$(BIN_DIR)/azure-cloud-controller-manager: $(PKG_CONFIG) $(wildcard cmd/cloud-controller-manager/*) $(wildcard cmd/cloud-controller-manager/**/*) $(wildcard pkg/**/*)
CGO_ENABLED=0 GOOS=linux go build -a -o $@ $(PKG_CONFIG_CONTENT) ./cmd/cloud-controller-manager
$(BIN_DIR)/azure-cloud-controller-manager: $(PKG_CONFIG) $(wildcard cmd/cloud-controller-manager/*) $(wildcard cmd/cloud-controller-manager/**/*) $(wildcard pkg/**/*) ## Build binary for controller-manager.
CGO_ENABLED=0 GOOS=linux go build -a -o $(BIN_DIR)/azure-cloud-controller-manager $(PKG_CONFIG_CONTENT) ./cmd/cloud-controller-manager

## --------------------------------------
## Images
##@ Images
## --------------------------------------

.PHONY: docker-pull-prerequisites
docker-pull-prerequisites:
docker-pull-prerequisites: ## Pull prerequisite images.
docker pull docker/dockerfile:1.1-experimental
docker pull docker.io/library/golang:1.15.8-stretch
docker pull gcr.io/distroless/static:latest

.PHONY: build-ccm-image
build-ccm-image: docker-pull-prerequisites
build-ccm-image: docker-pull-prerequisites ## Build controller-manager image.
DOCKER_BUILDKIT=1 docker build -t $(IMAGE) --build-arg ENABLE_GIT_COMMAND=$(ENABLE_GIT_COMMAND) .

.PHONY: build-node-image
build-node-image: docker-pull-prerequisites
build-node-image: docker-pull-prerequisites ## Build node-manager image for Windows.
DOCKER_BUILDKIT=1 docker build -t $(NODE_MANAGER_IMAGE) -f cloud-node-manager.Dockerfile --build-arg ENABLE_GIT_COMMAND=$(ENABLE_GIT_COMMAND) .

.PHONY: build-node-image-windows
build-node-image-windows:
build-node-image-windows: ## Build node-manager image for Windows.
go build -a -o $(BIN_DIR)/azure-cloud-node-manager.exe ./cmd/cloud-node-manager
docker build --platform windows/amd64 -t $(NODE_MANAGER_WINDOWS_IMAGE) -f cloud-node-manager-windows.Dockerfile .

.PHONY: build-ccm-e2e-test-image
build-ccm-e2e-test-image:
build-ccm-e2e-test-image: ## Build e2e test image.
docker build -t $(CCM_E2E_TEST_IMAGE) -f ./e2e.Dockerfile .

.PHONY: build-images
build-images: build-ccm-image build-node-image
build-images: build-ccm-image build-node-image ## Build all images.

.PHONY: image
image: build-ccm-image build-node-image
image: build-ccm-image build-node-image ## Build all images.

.PHONY: push-ccm-image
push-ccm-image:
push-ccm-image: ## Push controller-manager image.
docker push $(IMAGE)

.PHONY: push-node-image
push-node-image:
push-node-image: ## Push node-manager image for Linux.
docker push $(NODE_MANAGER_IMAGE)

.PHONY: push-node-image-windows
push-node-image-windows:
push-node-image-windows: ## Push node-manager image for Windows.
docker push $(NODE_MANAGER_WINDOWS_IMAGE)

.PHONY: push
push: push-ccm-image push-node-image
push: push-ccm-image push-node-image ## Push all images.

.PHONY: push-images
push-images: push-ccm-image push-node-image
push-images: push-ccm-image push-node-image ## Push all images.

.PHONY: release-ccm-e2e-test-image
release-ccm-e2e-test-image:
release-ccm-e2e-test-image: ## Build and release e2e test image.
docker build -t $(CCM_E2E_TEST_RELEASE_IMAGE) -f ./e2e.Dockerfile .
docker push $(CCM_E2E_TEST_RELEASE_IMAGE)

hyperkube:
hyperkube: ## Build hyperkube image.
ifneq ($(K8S_BRANCH), )
$(eval K8S_VERSION=$(shell REGISTRY=$(IMAGE_REGISTRY) BRANCH=$(K8S_BRANCH) hack/build-hyperkube.sh))
$(eval HYPERKUBE_IMAGE=$(IMAGE_REGISTRY)/hyperkube-amd64:$(K8S_VERSION))
endif

## --------------------------------------
## Tests
##@ Tests
## --------------------------------------

.PHONY: test-unit
test-unit: $(PKG_CONFIG)
test-unit: $(PKG_CONFIG) ## Run unit tests.
mkdir -p $(TEST_RESULTS_DIR)
hack/test-unit.sh | tee -a $(TEST_RESULTS_DIR)/unittest.txt
ifdef JUNIT
hack/convert-test-report.pl $(TEST_RESULTS_DIR)/unittest.txt > $(TEST_RESULTS_DIR)/unittest.xml
endif

.PHONY: test-check
test-check: test-lint test-boilerplate test-spelling test-gofmt test-govet
test-check: test-lint test-boilerplate test-spelling test-gofmt test-govet ## Run all static checks.

.PHONY: test-gofmt
test-gofmt:
test-gofmt: ## Run gofmt test.
hack/verify-gofmt.sh

.PHONY: test-govet
test-govet:
test-govet: ## Run govet test.
hack/verify-govet.sh

.PHONY: test-lint
test-lint:
test-lint: ## Run golint test.
hack/verify-golint.sh

.PHONY: test-boilerplate
test-boilerplate:
test-boilerplate: ## Run boilerplate test.
hack/verify-boilerplate.sh

.PHONY: test-spelling
test-spelling:
test-spelling: ## Run spelling test.
hack/verify-spelling.sh

.PHONY: update-dependencies
update-dependencies:
update-dependencies: ## Update dependencies and go modules.
hack/update-dependencies.sh

.PHONY: update-gofmt
update-gofmt:
update-gofmt: ## Update go formats.
hack/update-gofmt.sh

.PHONY: update
update: update-dependencies update-gofmt
update: update-dependencies update-gofmt ## Update go formats and dependencies.

test-e2e:
test-e2e: ## Run k8s e2e tests.
hack/test_k8s_e2e.sh $(TEST_E2E_ARGS)

test-ccm-e2e:
test-ccm-e2e: ## Run cloud provider e2e tests.
go test ./tests/e2e/ -timeout 0 -v -ginkgo.v $(CCM_E2E_ARGS)

.PHONY: clean
clean:
clean: ## Cleanup local builds.
rm -rf $(BIN_DIR) $(PKG_CONFIG) $(TEST_RESULTS_DIR)

$(PKG_CONFIG):
ENABLE_GIT_COMMANDS=$(ENABLE_GIT_COMMAND) hack/pkg-config.sh > $@

## --------------------------------------
## Release
##@ Release
## --------------------------------------

.PHONY: deploy
deploy: image push
deploy: image push ## Build, push and deploy an aks-engine cluster.
IMAGE=$(IMAGE) HYPERKUBE_IMAGE=$(HYPERKUBE_IMAGE) hack/deploy-cluster.sh

.PHONY: release-staging
release-staging:
release-staging: ## Release the cloud provider images.
ENABLE_GIT_COMMANDS=false IMAGE_REGISTRY=$(STAGING_REGISTRY) $(MAKE) build-images push-images

## --------------------------------------
Expand Down
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Cloud provider for Azure

[![Go Report Card](https://goreportcard.com/badge/sigs.k8s.io/cloud-provider-azure)](https://goreportcard.com/report/sigs.k8s.io/cloud-provider-azure)
[![Coverage Status](https://coveralls.io/repos/github/kubernetes-sigs/cloud-provider-azure/badge.svg?branch=master)](https://coveralls.io/github/kubernetes-sigs/cloud-provider-azure?branch=master)
[![GitHub stars](https://img.shields.io/github/stars/kubernetes-sigs/cloud-provider-azure.svg)](https://github.com/kubernetes-sigs/cloud-provider-azure/stargazers)
[![GitHub stars](https://img.shields.io/badge/contributions-welcome-orange.svg)](https://github.com/kubernetes-sigs/cloud-provider-azure/blob/master/CONTRIBUTING.md)

Expand All @@ -10,19 +11,20 @@ This repository provides Azure implementation of Kubernetes cloud provider [inte

## Current status

cloud-provider-azure is under **Beta** stage and its releases are maintained on Microsoft Container Registry (MCR).
`cloud-provider-azure` has been **GA** since v1.0.0 and its releases are maintained on Microsoft Container Registry (MCR).

The latest version of azure-cloud-controller-manager and azure-cloud-node-manager could be found at

* `mcr.microsoft.com/oss/kubernetes/azure-cloud-controller-manager:v0.7.4`
* `mcr.microsoft.com/oss/kubernetes/azure-cloud-node-manager:v0.7.4`
* `mcr.microsoft.com/oss/kubernetes/azure-cloud-controller-manager:v1.0.3`
* `mcr.microsoft.com/oss/kubernetes/azure-cloud-node-manager:v1.0.3`

Version matrix:

|Kubernetes version|cloud-provider version|cloud-provider branch|
|------------------|----------------------|---------------------|
| master | N/A | master |
| v1.20.x | v0.7.4 | release-0.7 |
| v1.21.x | v1.0.3 | release-1.0 |
| v1.20.x | v0.7.6 | release-0.7 |
| v1.19.x | v0.6.0 | release-0.6 |
| v1.18.x | v0.5.1 | release-0.5 |
| v1.17.x | v0.4.1 | N/A |
Expand All @@ -37,12 +39,6 @@ Build azure-cloud-controller-manager with pure make:
make
```

or with bazel:

```sh
make bazel-build
```

Build docker image for azure-cloud-controller-manager:

```sh
Expand Down Expand Up @@ -79,14 +75,14 @@ Please check the following documents for e2e tests:

## Documentation

- [Dependency management]([docs/dependency-management.md](http://kubernetes-sigs.github.io/cloud-provider-azure/development/dependencies/))
- [Dependency management](http://kubernetes-sigs.github.io/cloud-provider-azure/development/dependencies/)
- [Cloud provider config](http://kubernetes-sigs.github.io/cloud-provider-azure/install/configs/)
- [Azure load balancer and annotations](http://kubernetes-sigs.github.io/cloud-provider-azure/topics/loadbalancer/)
- [Azure permissions](http://kubernetes-sigs.github.io/cloud-provider-azure/topics/azure-permissions/)
- [Azure availability zones](http://kubernetes-sigs.github.io/cloud-provider-azure/topics/availability-zones/)
- [Cross resource group nodes]([docs/using-cross-resource-group-nodes.md](http://kubernetes-sigs.github.io/cloud-provider-azure/topics/cross-resource-group-nodes/))
- [AzureDisk known issues]([docs/persistentvolumes/azuredisk/issues.md](http://kubernetes-sigs.github.io/cloud-provider-azure/faq/known-issues/azuredisk/))
- [AzureFile known issues]([docs/persistentvolumes/azurefile/issues.md](http://kubernetes-sigs.github.io/cloud-provider-azure/faq/known-issues/azurefile/))
- [Cross resource group nodes](http://kubernetes-sigs.github.io/cloud-provider-azure/topics/cross-resource-group-nodes/)
- [AzureDisk known issues](http://kubernetes-sigs.github.io/cloud-provider-azure/faq/known-issues/azuredisk/)
- [AzureFile known issues](http://kubernetes-sigs.github.io/cloud-provider-azure/faq/known-issues/azurefile/)

See [kubernetes-sigs.github.io/cloud-provider-azure](https://kubernetes-sigs.github.io/cloud-provider-azure/) for more documentations.

Expand Down
6 changes: 3 additions & 3 deletions cmd/cloud-controller-manager/app/controllermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ func Run(ctx context.Context, c *cloudcontrollerconfig.CompletedConfig) error {
if c.DynamicReloadingConfig.EnableDynamicReloading {
cloud, err = provider.NewCloudFromSecret(c.ClientBuilder, c.DynamicReloadingConfig.CloudConfigSecretName, c.DynamicReloadingConfig.CloudConfigSecretNamespace, c.DynamicReloadingConfig.CloudConfigKey)
if err != nil {
klog.Fatalf("Run: Cloud provider could not be initialized dynamically from secret %s/%s: %v", c.DynamicReloadingConfig.CloudConfigSecretNamespace, c.DynamicReloadingConfig.CloudConfigSecretName, err)
klog.Fatalf("Run: Cloud provider azure could not be initialized dynamically from secret %s/%s: %v", c.DynamicReloadingConfig.CloudConfigSecretNamespace, c.DynamicReloadingConfig.CloudConfigSecretName, err)
}
} else {
cloud, err = cloudprovider.InitCloudProvider(c.ComponentConfig.KubeCloudShared.CloudProvider.Name, c.ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile)
cloud, err = provider.NewCloudFromConfigFile(c.ComponentConfig.KubeCloudShared.CloudProvider.CloudConfigFile, true)
if err != nil {
klog.Fatalf("Cloud provider could not be initialized: %v", err)
klog.Fatalf("Cloud provider azure could not be initialized: %v", err)
}
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/cloud-controller-manager/app/options/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (o *DynamicReloadingOptions) AddFlags(fs *pflag.FlagSet) {
}

fs.BoolVar(&o.EnableDynamicReloading, "enable-dynamic-reloading", false, "Enable re-configuring cloud controller manager from secret without restarting")
fs.StringVar(&o.CloudConfigSecretName, "cloud-config-secret-name", "cloud-provider-config", "The name of the cloud config secret, default to 'cloud-provider-config'")
fs.StringVar(&o.CloudConfigSecretName, "cloud-config-secret-name", "azure-cloud-provider", "The name of the cloud config secret, default to 'cloud-provider-config'")
fs.StringVar(&o.CloudConfigSecretNamespace, "cloud-config-secret-namespace", "kube-system", "The k8s namespace of the cloud config secret, default to 'kube-system'")
fs.StringVar(&o.CloudConfigKey, "cloud-config-key", "cloud-config", "The key of the config data in the cloud config secret, default to 'cloud-config'")
}
Expand All @@ -64,8 +64,8 @@ func (o *DynamicReloadingOptions) Validate() []error {
func defaultDynamicReloadingOptions() *DynamicReloadingOptions {
return &DynamicReloadingOptions{
EnableDynamicReloading: false,
CloudConfigSecretName: "",
CloudConfigSecretNamespace: "",
CloudConfigSecretName: "azure-cloud-provider",
CloudConfigSecretNamespace: "kube-system",
CloudConfigKey: "",
}
}
4 changes: 2 additions & 2 deletions cmd/cloud-controller-manager/app/options/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ func TestDefaultFlags(t *testing.T) {
NodeStatusUpdateFrequency: metav1.Duration{Duration: 5 * time.Minute},
DynamicReloading: &DynamicReloadingOptions{
EnableDynamicReloading: false,
CloudConfigSecretName: "",
CloudConfigSecretNamespace: "",
CloudConfigSecretName: "azure-cloud-provider",
CloudConfigSecretNamespace: "kube-system",
CloudConfigKey: "",
},
}
Expand Down
2 changes: 1 addition & 1 deletion examples/out-of-tree/cloud-controller-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ spec:
effect: NoSchedule
containers:
- name: cloud-controller-manager
image: mcr.microsoft.com/oss/kubernetes/azure-cloud-controller-manager:v0.7.4
image: mcr.microsoft.com/oss/kubernetes/azure-cloud-controller-manager:v1.0.1
imagePullPolicy: IfNotPresent
command: ["cloud-controller-manager"]
args:
Expand Down

0 comments on commit 799f060

Please sign in to comment.