Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
chore: promote crd to apiextensions.k8s.io/v1 (#1035)
Browse files Browse the repository at this point in the history
Signed-off-by: Ernest Wong <[email protected]>
  • Loading branch information
Ernest Wong authored Apr 15, 2021
1 parent 7574874 commit 38c46a4
Show file tree
Hide file tree
Showing 23 changed files with 2,883 additions and 385 deletions.
3 changes: 2 additions & 1 deletion .pipelines/templates/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ jobs:
displayName: "Run E2E tests"
- script: |
az role assignment delete --ids ${ROLE_ASSIGNMENT_IDS} || true
if [[ "${CLUSTER_CONFIG}" == "aks" ]]; then
az aks delete -g ${RESOURCE_GROUP} -n ${RESOURCE_GROUP} --yes --no-wait
fi
az group delete -g ${RESOURCE_GROUP} --yes --no-wait
condition: always()
displayName: "Delete resource group"
displayName: "Delete resource group and role assignments"
- template: cleanup-images.yml
1 change: 1 addition & 0 deletions .pipelines/templates/load-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ jobs:
- template: publish-load-test-result.yml

- script: |
az role assignment delete --ids ${ROLE_ASSIGNMENT_IDS} || true
az aks delete -g ${RESOURCE_GROUP} -n ${RESOURCE_GROUP} --yes --no-wait
az group delete -g ${RESOURCE_GROUP} --yes --no-wait
sudo rm -rf $(GOPATH)
Expand Down
12 changes: 9 additions & 3 deletions .pipelines/templates/role-assignment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,25 @@ parameters:
steps:
- script: |
ASSIGNEE_OBJECT_ID="$(az identity show -g ${{ parameters.node_resource_group }} -n ${{ parameters.resource_group }}-agentpool --query principalId -otsv)"
ROLE_ASSIGNMENT_IDS=""
az role assignment create --assignee-object-id "${ASSIGNEE_OBJECT_ID}" --role "Virtual Machine Contributor" --scope "/subscriptions/${{ parameters.subscription_id }}/resourcegroups/${{ parameters.node_resource_group }}"
az role assignment create --assignee-object-id "${ASSIGNEE_OBJECT_ID}" --role "Managed Identity Operator" --scope "/subscriptions/${{ parameters.subscription_id }}/resourcegroups/${{ parameters.node_resource_group }}"
if [[ -n "${{ parameters.keyvault_resource_group }}" ]]; then
az role assignment create --assignee-object-id "${ASSIGNEE_OBJECT_ID}" --role "Reader" --scope "/subscriptions/${{ parameters.subscription_id }}/resourcegroups/${{ parameters.keyvault_resource_group }}/providers/Microsoft.KeyVault/vaults/${{ parameters.keyvault_name }}"
ID="$(az role assignment create --assignee-object-id "${ASSIGNEE_OBJECT_ID}" --role "Reader" --scope "/subscriptions/${{ parameters.subscription_id }}/resourcegroups/${{ parameters.keyvault_resource_group }}/providers/Microsoft.KeyVault/vaults/${{ parameters.keyvault_name }}" --query id -otsv)"
ROLE_ASSIGNMENT_IDS+="${ID} "
az keyvault set-policy -n ${{ parameters.keyvault_name }} --secret-permissions get --object-id "${ASSIGNEE_OBJECT_ID}"
fi
if [[ -n "${{ parameters.identity_resource_group }}" ]]; then
az role assignment create --assignee-object-id "${ASSIGNEE_OBJECT_ID}" --role "Managed Identity Operator" --scope "/subscriptions/${{ parameters.subscription_id }}/resourcegroups/${{ parameters.identity_resource_group }}"
ID="$(az role assignment create --assignee-object-id "${ASSIGNEE_OBJECT_ID}" --role "Managed Identity Operator" --scope "/subscriptions/${{ parameters.subscription_id }}/resourcegroups/${{ parameters.identity_resource_group }}" --query id -otsv)"
ROLE_ASSIGNMENT_IDS+="${ID} "
fi
if [[ -n "${{ parameters.registry_name }}" ]]; then
az role assignment create --assignee-object-id "${ASSIGNEE_OBJECT_ID}" --role "AcrPull" --scope "/subscriptions/$(SUBSCRIPTION_ID)/resourceGroups/${{ parameters.acr_resource_group }}/providers/Microsoft.ContainerRegistry/registries/${{ parameters.registry_name }}"
ID="$(az role assignment create --assignee-object-id "${ASSIGNEE_OBJECT_ID}" --role "AcrPull" --scope "/subscriptions/$(SUBSCRIPTION_ID)/resourceGroups/${{ parameters.acr_resource_group }}/providers/Microsoft.ContainerRegistry/registries/${{ parameters.registry_name }}" --query id -otsv)"
ROLE_ASSIGNMENT_IDS+="${ID} "
fi
echo "##vso[task.setvariable variable=ROLE_ASSIGNMENT_IDS]${ROLE_ASSIGNMENT_IDS}"
displayName: "Add role assignment"
29 changes: 24 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,31 @@ BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7
# Output type of docker buildx build
OUTPUT_TYPE ?= registry

$(TOOLS_DIR)/golangci-lint: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
CONTROLLER_GEN := $(TOOLS_DIR)/controller-gen
GOLANGCI_LINT := $(TOOLS_DIR)/golangci-lint
KUSTOMIZE := $(TOOLS_DIR)/kustomize
MISSPELL := $(TOOLS_DIR)/misspell

$(CONTROLLER_GEN): $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
cd $(TOOLS_MOD_DIR) && \
go build -o $(TOOLS_DIR)/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen

$(GOLANGCI_LINT): $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
cd $(TOOLS_MOD_DIR) && \
go build -o $(TOOLS_DIR)/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint

$(TOOLS_DIR)/misspell: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
$(KUSTOMIZE): $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
cd $(TOOLS_MOD_DIR) && \
go build -o $(TOOLS_DIR)/kustomize sigs.k8s.io/kustomize/kustomize/v3

$(MISSPELL): $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
cd $(TOOLS_MOD_DIR) && \
go build -o $(TOOLS_DIR)/misspell github.com/client9/misspell/cmd/misspell

.PHONY: lint
lint: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell
$(TOOLS_DIR)/golangci-lint run --timeout=5m
$(TOOLS_DIR)/misspell -w $(ALL_DOCS)
lint: $(GOLANGCI_LINT) $(MISSPELL)
$(GOLANGCI_LINT) run --timeout=5m
$(MISSPELL) -w $(ALL_DOCS)
$(MAKE) check-mod

.PHONY: clean-nmi
Expand Down Expand Up @@ -225,3 +238,9 @@ helm-lint:
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
# run lint on helm charts
helm lint --strict manifest_staging/charts/aad-pod-identity

.PHONY: generate-crds
generate-crds: $(CONTROLLER_GEN) $(KUSTOMIZE)
$(CONTROLLER_GEN) crd:trivialVersions=true paths=./pkg/apis/aadpodidentity/v1/...
$(KUSTOMIZE) build config/crd > config/crd/aadpodidentity.k8s.io.yaml
rm -rf config/crd/aadpodidentity.k8s.io_*
Loading

0 comments on commit 38c46a4

Please sign in to comment.