provider-azuredevops

module
v0.0.0-...-63ea1e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2023 License: Apache-2.0

README

Crossplane AzureDevops Provider



CI Go Report Card License GitHub go.mod Go version


provider-azuredevops is a Crossplane provider that is built using Upjet code generation tools and exposes XRM-conformant managed resources for the AzureDevops API.

Getting Started

Install the provider by using the following command after changing the image tag to the latest release:

up ctp provider install r3drun3/provider-azuredevops:v0.1.0

Alternatively, you can use declarative installation:

cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
  name: provider-azuredevops
spec:
  package: r3drun3/provider-azuredevops:v0.1.0
EOF

Notice that in this example Provider resource is referencing ControllerConfig with debug enabled.

You can see the API reference here.

Developing

Run code-generation pipeline:

go run cmd/generator/main.go "$PWD"

Run against a Kubernetes cluster:

make run

Build, push, and install:

make all

Build binary:

make build

Local development and demo

clone this repo:

git clone https://github.com/R3DRUN3/provider-azuredevops.git && cd provider-azuredevops

Start a local kubernetes cluster (we will use kind):

kind create cluster --config ./k8s-local/kind-config.yml

Now we can generate our Upjet Provider:

make generate

Note: In case the previous command gave you the panic: cannot run goimports for apis folder: bash: goimports: command not found error, on macOS you can run:

export PATH="$PATH:$HOME/go/bin" && make generate

Apply Custom Resource Definitions:

kubectl apply -f package/crds

Under examples/providerconfig create a kubernetes secrets with your azuredevops org url and access token:

cat <<EOF > examples/providerconfig/secret.yaml
apiVersion: v1
kind: Secret
metadata:
  name: example-creds
  namespace: crossplane-system
type: Opaque
stringData:
  credentials: |
    {
      "personal_access_token": "your azure devops personal access token",
      "org_service_url": "your azure devops org url"
    }
EOF

Run the provider:

make run

Note: if you see error when launching the make command, try to run the following command first:

git rm --cached build && git submodule add https://github.com/upbound/build build

Now open a new terminal and apply all the required resources:

kubectl create namespace crossplane-system --dry-run=client -o yaml | kubectl apply -f - \
&& kubectl apply -f examples/providerconfig/ \
&& kubectl apply -f examples/project/project.yaml \
&& kubectl apply -f examples/gitrepository/gitrepository.yaml

This will create a new azure devops project in your organization:

and a repository inside your project:


To retrieve the created resources run the following command:

kubectl get managed

NAME                                                                          READY   SYNCED   EXTERNAL-NAME                          AGE
repository.gitrepository.azuredevops.upbound.io/hello-crossplane-repository   True    False    e03861d4-ce5d-43cc-899e-ed4a4c99d5d0   14m

NAME                                                              READY   SYNCED   EXTERNAL-NAME                          AGE
project.project.azuredevops.upbound.io/hello-crossplane-project   True    True     7482fede-2c79-402c-b730-5dfafb1b5a24   24m

If you want to check resource status use the describe command, for example:

k describe repository.gitrepository.azuredevops.upbound.io/hello-crossplane-repository 

If you want to delete the created resource on azure, simply run:

kubectl delete -f examples/project/project.yaml

Report a Bug

For filing bugs, suggesting improvements, or requesting new features, please open an issue.

Directories

Path Synopsis
Package apis contains Kubernetes API for the provider.
Package apis contains Kubernetes API for the provider.
gitrepository/v1alpha1
+kubebuilder:object:generate=true +groupName=gitrepository.azuredevops.upbound.io +versionName=v1alpha1
+kubebuilder:object:generate=true +groupName=gitrepository.azuredevops.upbound.io +versionName=v1alpha1
project/v1alpha1
+kubebuilder:object:generate=true +groupName=project.azuredevops.upbound.io +versionName=v1alpha1
+kubebuilder:object:generate=true +groupName=project.azuredevops.upbound.io +versionName=v1alpha1
v1alpha1
Package v1alpha1 contains the core resources of the azuredevops jet provider.
Package v1alpha1 contains the core resources of the azuredevops jet provider.
v1beta1
Package v1beta1 contains the core resources of the azuredevops upjet provider.
Package v1beta1 contains the core resources of the azuredevops upjet provider.
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL