### Install AWS S3 Provider with Helm Source: https://docs.crossplane.io/latest/packages/providers Use the `--set provider.packages` argument with `helm install` to install Providers during the initial Crossplane setup. This example installs the AWS S3 Provider. ```bash helm install crossplane \ crossplane-stable/crossplane \ --namespace crossplane-system \ --create-namespace \ --set provider.packages='{xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.0.0}' ``` -------------------------------- ### Test Safe Start Workflow with Helm and Kubectl Source: https://docs.crossplane.io/latest/guides/implementing-safe-start This workflow demonstrates how to install Crossplane, apply a provider, and verify safe-start behavior by checking MRD and CRD states before and after applying an activation policy. ```bash 1# Install Crossplane v2.0+ 2helm install crossplane crossplane-stable/crossplane \ 3 --namespace crossplane-system \ 4 --set provider.defaultActivations={} 5 6# Install your provider 7kubectl apply -f provider.yaml 8 9# Check that MRDs are created but inactive 10kubectl get mrds 11# All should show STATE: Inactive 12 13# No CRDs should exist yet 14kubectl get crds | grep yourprovider.m.crossplane.io 15# Should return no results 16 17# Create activation policy 18kubectl apply -f - < provider xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.0.0 ``` -------------------------------- ### Apply Example Composition Source: https://docs.crossplane.io/latest/composition/composition-revisions Apply the example Composition manifest to define a new composite resource type. ```yaml apiVersion: apiextensions.crossplane.io/v1 kind: Composition metadata: labels: channel: dev name: myvpcs.aws.example.upbound.io spec: compositeTypeRef: apiVersion: aws.example.upbound.io/v1alpha1 kind: MyVPC mode: Pipeline pipeline: - step: patch-and-transform functionRef: name: function-patch-and-transform input: apiVersion: pt.fn.crossplane.io/v1beta1 kind: Resources resources: - name: my-vpc base: apiVersion: ec2.aws.m.upbound.io/v1beta1 kind: VPC spec: forProvider: region: us-west-1 cidrBlock: 192.168.0.0/16 enableDnsSupport: true enableDnsHostnames: true ``` -------------------------------- ### Create Gated Controller Setup Function Source: https://docs.crossplane.io/latest/guides/implementing-safe-start Implement `SetupGated` to register controller setup with the gate, ensuring the required CRD is active before proceeding. This function calls your existing `Setup` function. ```go // SetupGated registers controller setup with the gate, waiting for the // required CRD func SetupGated(mgr ctrl.Manager, o controller.Options) error { o.Gate.Register(func() { if err := Setup(mgr, o); err != nil { panic(err) } }, v1alpha1.MyResourceGroupVersionKind) return nil } // Setup is your existing controller setup function (unchanged) func Setup(mgr ctrl.Manager, o controller.Options) error { // existing controller setup code... } ``` -------------------------------- ### Install Provider using image digest Source: https://docs.crossplane.io/latest/packages/providers For deterministic and repeatable installations, use image digests instead of tags. This example specifies the AWS S3 Provider package using its SHA256 digest. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Provider metadata: name: crossplane-contrib-provider-aws-s3 spec: package: xpkg.crossplane.io/crossplane-contrib/provider-aws-s3@sha256:ee6bece46dbb54cc3f0233961f5baac317fa4e4a81b41198bdc72fc472d113d0 ``` -------------------------------- ### Install a Configuration Package Source: https://docs.crossplane.io/latest/packages/configurations Install a Configuration with a Crossplane `Configuration` object by setting the `spec.package` value to the location of the configuration package. Use image digests for deterministic and repeatable installations. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Configuration metadata: name: configuration-quickstart spec: package: xpkg.crossplane.io/crossplane-contrib/configuration-quickstart:v0.1.0 ``` ```yaml apiVersion: pkg.crossplane.io/v1 kind: Configuration metadata: name: configuration-quickstart spec: package: xpkg.crossplane.io/crossplane-contrib/configuration-quickstart@sha256:ef9795d146190637351a5c5848e0bab5e0c190fec7780f6c426fbffa0cb68358 ``` -------------------------------- ### Install Python Support Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition?tab=tab-1333 Install the `function-python` to enable Python support in your compositions. Save the configuration to `fn.yaml` and apply it. ```yaml 1apiVersion: pkg.crossplane.io/v1 2kind: Function 3metadata: 4 name: function-python 5spec: 6 package: xpkg.crossplane.io/crossplane-contrib/function-python:v0.2.0 ``` ```bash 1kubectl apply -f fn.yaml ``` -------------------------------- ### Install Kubernetes Provider with Changelogs Enabled Source: https://docs.crossplane.io/latest/guides/change-logs Install the Kubernetes provider and configure it to use the DeploymentRuntimeConfig for enabling changelogs. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Provider metadata: name: provider-kubernetes spec: package: xpkg.crossplane.io/crossplane-contrib/provider-kubernetes:v0.18.0 runtimeConfigRef: apiVersion: pkg.crossplane.io/v1beta1 kind: DeploymentRuntimeConfig name: enable-changelogs ``` -------------------------------- ### Install Python Support Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition?tab=tab-1205 Use this to install the Python support function. Save the definition to `fn.yaml` and apply it with `kubectl apply -f fn.yaml`. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Function metadata: name: function-python spec: package: xpkg.crossplane.io/crossplane-contrib/function-python:v0.2.0 ``` -------------------------------- ### Install YAML Support Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition?tab=tab-1205 Use this to install the YAML support function. Save the definition to `fn.yaml` and apply it with `kubectl apply -f fn.yaml`. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Function metadata: name: function-patch-and-transform spec: package: xpkg.crossplane.io/crossplane-contrib/function-patch-and-transform:v0.10.0 ``` -------------------------------- ### Install YAML Composition Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition?tab=tab-247 Use this to install YAML support for composition functions. Save the definition to `fn.yaml` and apply it using kubectl. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Function metadata: name: function-patch-and-transform spec: package: xpkg.crossplane.io/crossplane-contrib/function-patch-and-transform:v0.10.0 ``` ```bash kubectl apply -f fn.yaml ``` ```bash kubectl get -f fn.yaml NAME INSTALLED HEALTHY PACKAGE AGE function-patch-and-transform True True xpkg.crossplane.io/crossplane-contrib/function-patch-and-transform:v0.10.0 8s ``` -------------------------------- ### Install Python Support Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition?tab=tab-1187 Install the Python support function. Apply the saved YAML file using kubectl. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Function metadata: name: function-python spec: package: xpkg.crossplane.io/crossplane-contrib/function-python:v0.2.0 ``` ```bash kubectl apply -f fn.yaml ``` -------------------------------- ### Install Python Support Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition?tab=tab-1141 Use this to install the `function-python` for Python support. Apply the saved YAML file using kubectl. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Function metadata: name: function-python spec: package: xpkg.crossplane.io/crossplane-contrib/function-python:v0.2.0 ``` ```bash kubectl apply -f fn.yaml ``` ```bash kubectl get -f fn.yaml NAME INSTALLED HEALTHY PACKAGE AGE function-python True True xpkg.crossplane.io/crossplane-contrib/function-python:v0.2.0 12s ``` -------------------------------- ### Install Crossplane with Custom Image Source: https://docs.crossplane.io/latest/guides/install-from-source Use the Helm chart to install Crossplane with a custom container image. Ensure the registry and tag are correctly specified. ```bash helm install crossplane result/charts/crossplane-${VERSION#v}.tgz \ --namespace crossplane-system \ --create-namespace \ --set image.repository=${REGISTRY}/crossplane \ --set image.tag=${VERSION} \ --set image.pullPolicy=IfNotPresent ``` -------------------------------- ### Install Templated YAML Support Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition?tab=tab-1333 Install the `function-go-templating` for templated YAML support, similar to Helm charts. Apply the `fn.yaml` file with kubectl. ```yaml 1apiVersion: pkg.crossplane.io/v1 2kind: Function 3metadata: 4 name: function-go-templating 5spec: 6 package: xpkg.crossplane.io/crossplane-contrib/function-go-templating:v0.11.2 ``` ```bash 1kubectl apply -f fn.yaml ``` -------------------------------- ### Install Python Support Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition Use this YAML to install the `function-python` for Python support. Apply the saved `fn.yaml` file using kubectl. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Function metadata: name: function-python spec: package: xpkg.crossplane.io/crossplane-contrib/function-python:v0.2.0 ``` ```bash kubectl apply -f fn.yaml ``` ```bash kubectl get -f fn.yaml ``` -------------------------------- ### Full fn.go File Example Source: https://docs.crossplane.io/latest/guides/write-a-composition-function-in-go This Go file defines a Composition Function that observes an XR and adds desired S3 buckets based on its spec. ```go package main import ( "context" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" "github.com/upbound/provider-aws/v2/apis/namespaced/s3/v1beta1" "github.com/crossplane/function-sdk-go/errors" "github.com/crossplane/function-sdk-go/logging" fnv1 "github.com/crossplane/function-sdk-go/proto/v1" "github.com/crossplane/function-sdk-go/request" "github.com/crossplane/function-sdk-go/resource" "github.com/crossplane/function-sdk-go/resource/composed" "github.com/crossplane/function-sdk-go/response" ) // Function returns whatever response you ask it to. type Function struct { fnv1.UnimplementedFunctionRunnerServiceServer log logging.Logger } // RunFunction observes an XBuckets composite resource (XR). It adds an S3 // bucket to the desired state for every entry in the XR's spec.names array. func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest) (*fnv1.RunFunctionResponse, error) { f.log.Info("Running Function", "tag", req.GetMeta().GetTag()) // Create a response to the request. This copies the desired state and // pipeline context from the request to the response. rsp := response.To(req, response.DefaultTTL) // Read the observed XR from the request. Most functions use the observed XR // to add desired managed resources. xr, err := request.GetObservedCompositeResource(req) if err != nil { // You can set a custom status condition on the XR. This // allows you to communicate with the user. response.ConditionFalse(rsp, "FunctionSuccess", "InternalError"). WithMessage("Something went wrong."). TargetComposite() // You can emit an event regarding the XR. This allows you to // communicate with the user. Note that events should be used // sparingly and are subject to throttling response.Warning(rsp, errors.New("something went wrong")), TargetComposite() // If the function can't read the XR, the request is malformed. This // should never happen. The function returns a fatal result. This tells // Crossplane to stop running functions and return an error. response.Fatal(rsp, errors.Wrapf(err, "cannot get observed composite resource from %T", req)) return rsp, nil } // Create an updated logger with useful information about the XR. log := f.log.WithValues( "xr-version", xr.Resource.GetAPIVersion(), "xr-kind", xr.Resource.GetKind(), "xr-name", xr.Resource.GetName(), ) // Get the region from the XR. The XR has getter methods like GetString, // GetBool, etc. You can use them to get values by their field path. region, err := xr.Resource.GetString("spec.region") if err != nil { response.Fatal(rsp, errors.Wrapf(err, "cannot read spec.region field of %s", xr.Resource.GetKind())) return rsp, nil } // Get the array of bucket names from the XR. names, err := xr.Resource.GetStringArray("spec.names") if err != nil { response.Fatal(rsp, errors.Wrapf(err, "cannot read spec.names field of %s", xr.Resource.GetKind())) return rsp, nil } // Get all desired composed resources from the request. The function will // update this map of resources, then save it. This get, update, set pattern // ensures the function keeps any resources added by other functions. desired, err := request.GetDesiredComposedResources(req) if err != nil { response.Fatal(rsp, errors.Wrapf(err, "cannot get desired resources from %T", req)) return rsp, nil } // Add v1beta1 types (including Bucket) to the composed resource scheme. // composed.From uses this to automatically set apiVersion and kind. _ = v1beta1.AddToScheme(composed.Scheme) // Add a desired S3 bucket for each name. for _, name := range names { // One advantage of writing a function in Go is strong typing. The // function can import and use managed resource types from the provider. b := &v1beta1.Bucket{ ObjectMeta: metav1.ObjectMeta{ // Set the external name annotation to the desired bucket name. // This controls what the bucket will be named in AWS. Annotations: map[string]string{ "crossplane.io/external-name": name, }, }, Spec: v1beta1.BucketSpec{ ForProvider: v1beta1.BucketParameters{ // Set the bucket's region to the value read from the XR. Region: ptr.To[string](region), }, }, } // Convert the bucket to the unstructured resource data format the SDK // uses to store desired composed resources. cd, err := composed.From(b) if err != nil { response.Fatal(rsp, errors.Wrapf(err, "cannot convert %T to %T", b, &composed.Unstructured{})) return rsp, nil } ``` -------------------------------- ### List Installed Providers Source: https://docs.crossplane.io/latest/guides/uninstall-crossplane Use `kubectl get providers` to list all installed Crossplane providers. ```bash 1kubectl get providers 2NAME INSTALLED HEALTHY PACKAGE AGE 3crossplane-contrib-provider-aws-s3 True True xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.0.0 8h ``` -------------------------------- ### Verify CompositeResourceDefinition with kubectl Source: https://docs.crossplane.io/latest/composition/composite-resource-definitions Verify an XRD installation using `kubectl get compositeresourcedefinition` or its short form, `kubectl get xrd`. The `ESTABLISHED` field indicates if Crossplane has installed the custom resource definition. ```bash kubectl get xrd NAME ESTABLISHED OFFERED AGE xdatabases.custom-api.example.org True True 22m ``` -------------------------------- ### Verify Provider Installation Status Source: https://docs.crossplane.io/latest/packages/providers Use `kubectl get providers` to view the installation status of Providers. Initially, a Provider reports `INSTALLED` as `True` and `HEALTHY` as `Unknown`. ```bash 1kubectl get providers 2NAME INSTALLED HEALTHY PACKAGE AGE 3crossplane-contrib-provider-aws-s3 True Unknown xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.0.0 63s ``` -------------------------------- ### Basic RunFunction Implementation in Go Source: https://docs.crossplane.io/latest/guides/write-a-composition-function-in-go This is a basic "hello world" implementation of the `RunFunction` method. It logs the function tag and returns a response with a default TTL. Use this as a starting point for your function logic. ```go func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest) (*fnv1.RunFunctionResponse, error) { f.log.Info("Running Function", "tag", req.GetMeta().GetTag()) rsp := response.To(req, response.DefaultTTL) in := &v1beta1.Input{} if err := request.GetInput(req, in); err != nil { response.Fatal(rsp, errors.Wrapf(err, "cannot get Function input from %T", req)) return rsp, nil } response.Normalf(rsp, "I was run with input %q", in.Example) return rsp, nil } ``` -------------------------------- ### Check Provider Installation Status Source: https://docs.crossplane.io/latest/guides/crossplane-with-workload-identity Verify the status of the installed Crossplane Provider. Use `kubectl get` for a summary and `kubectl describe` for detailed information, including any errors during installation. ```bash kubectl get provider provider-gcp-storage kubectl describe provider provider-gcp-storage ``` -------------------------------- ### Verify a Configuration status Source: https://docs.crossplane.io/latest/packages/configurations Use `kubectl get configuration` to check if a Configuration is installed and healthy. A healthy configuration shows `Installed` and `Healthy` as `True`. ```bash 1kubectl get configuration 2NAME INSTALLED HEALTHY PACKAGE AGE 3platform-ref-aws True True xpkg.crossplane.io/crossplane-contrib/configuration-quickstart:v0.1.0 54s ``` -------------------------------- ### Initialize a Go Function from Template Source: https://docs.crossplane.io/latest/guides/write-a-composition-function-in-go Use the `crossplane xpkg init` command with a Go template to create a new function project. This command sets up the basic directory structure and essential files. ```bash crossplane xpkg init function-xbuckets function-template-go -d function-xbuckets ``` -------------------------------- ### Install Crossplane Provider from ACR Source: https://docs.crossplane.io/latest/guides/crossplane-with-workload-identity Example of installing a Crossplane Provider (e.g., provider-azure-storage) directly from Azure Container Registry (ACR) after Workload Identity is configured. ```bash kubectl apply -f - <` to inspect the activation policy. ```bash 1kubectl get mrds -o wide 2kubectl describe mrap ``` -------------------------------- ### Verify Provider Health Status Source: https://docs.crossplane.io/latest/packages/providers Once a Provider installation is complete and it is ready for use, the `HEALTHY` status will report `True` when checked with `kubectl get providers`. ```bash 1kubectl get providers 2NAME INSTALLED HEALTHY PACKAGE AGE 3crossplane-contrib-provider-aws-s3 True True xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.0.0 88s ``` -------------------------------- ### Install Auto-Ready Function Source: https://docs.crossplane.io/latest/guides/connection-details-composition?tab=tab-1141 Install the `function-auto-ready` to automatically mark composed resources as ready when they are healthy. Apply the saved YAML file using kubectl. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Function metadata: name: function-auto-ready spec: package: xpkg.crossplane.io/crossplane-contrib/function-auto-ready:v0.6.0 ``` ```bash kubectl apply -f fn-auto-ready.yaml ``` -------------------------------- ### Get Crossplane CLI and Control Plane Version Source: https://docs.crossplane.io/latest/cli/command-reference Use the `crossplane version` command to display the installed versions of the Crossplane CLI and the control plane. ```bash crossplane version ``` ```text Client Version: v1.17.0 Server Version: v1.17.0 ``` -------------------------------- ### List Composite Resource Definitions (XRDs) Source: https://docs.crossplane.io/latest/guides/uninstall-crossplane View all installed Composite Resource Definitions (XRDs) using `kubectl get xrd`. This helps identify which composite resources are deployed. ```bash kubectl get xrd ``` -------------------------------- ### Create AWS Bucket with Admin ProviderConfig Source: https://docs.crossplane.io/latest/packages/providers This example demonstrates creating a second AWS `Bucket` resource, this time using the `admin-keys` `ProviderConfig` for authentication. ```yaml apiVersion: s3.aws.m.upbound.io/v1beta1 kind: Bucket metadata: namespace: default name: admin-bucket spec: forProvider: region: us-east-2 providerConfigRef: name: admin-keys kind: ProviderConfig ``` -------------------------------- ### Setup Python Environment for Function Packages Source: https://docs.crossplane.io/latest/guides/extensions-release-process Configures the GitHub Actions runner with a specific Python version and installs Hatch for managing Python projects. Useful for building Python-based function packages. ```yaml - name: Setup Python uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - name: Setup Hatch run: pipx install hatch==1.7.0 - name: Lint run: hatch run lint:check ``` -------------------------------- ### Hello World Composition Function in Go Source: https://docs.crossplane.io/latest/composition/compositions A basic 'hello world' example of a composition function written in Go. This snippet demonstrates the basic structure of a RunFunction implementation. ```go func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest) (*fnv1.RunFunctionResponse, error) { rsp := response.To(req, response.DefaultTTL) response.Normal(rsp, "Hello world!") return rsp, nil } ``` -------------------------------- ### Get AWS Provider Go Module Source: https://docs.crossplane.io/latest/guides/write-a-composition-function-in-go Installs the AWS Provider Go module, which is necessary for using strongly typed resource structs like `v1beta1.Bucket` within your Go composition function. ```bash go get github.com/upbound/provider-aws/v2@v2.3.0 ``` -------------------------------- ### startupProbe Source: https://docs.crossplane.io/latest/api StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod’s lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. ```APIDOC ## startupProbe ### Description StartupProbe indicates that the Pod has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a Pod’s lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes ### Type object ### Required false ``` -------------------------------- ### View Provider Revisions Source: https://docs.crossplane.io/latest/packages/providers Use `kubectl get providerrevisions` to list all revisions of installed Provider packages. This command shows the health, revision number, image, state (Active/Inactive), and dependency status for each revision. ```bash kubectl get providerrevisions ``` -------------------------------- ### Initialize the Gate in Main Function Source: https://docs.crossplane.io/latest/guides/implementing-safe-start Initialize a `gate.Gate` in your provider's `main` function and add the `apiextensionsv1` scheme for the gate controller. Ensure the `customresourcesgate.Setup` is called. ```go func main() { // existing setup code... o := controller.Options{ // existing options... Gate: new(gate.Gate[schema.GroupVersionKind]), } // Add CustomResourceDefinition to scheme for gate controller if err := apiextensionsv1.AddToScheme(mgr.GetScheme()); err != nil { panic(err) } // Setup controllers if err := yourprovider.Setup(mgr, o); err != nil { panic(err) } // Setup the CRD gate controller if err := customresourcesgate.Setup(mgr, o); err != nil { panic(err) } // start manager... } ``` -------------------------------- ### Install a Crossplane provider Source: https://docs.crossplane.io/latest/guides/disabling-unused-managed-resources Install a Crossplane provider using its package. Crossplane automatically converts the provider's CRDs to ManagedResourceDefinitions upon installation. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Provider metadata: name: provider-aws-ec2 spec: package: xpkg.crossplane.io/provider-aws-ec2:v2.0.0 ``` -------------------------------- ### Create AWS Bucket with User ProviderConfig Source: https://docs.crossplane.io/latest/packages/providers This example demonstrates creating an AWS `Bucket` resource using the `user-keys` `ProviderConfig` for authentication. ```yaml apiVersion: s3.aws.m.upbound.io/v1beta1 kind: Bucket metadata: namespace: default name: user-bucket spec: forProvider: region: us-east-2 providerConfigRef: name: user-keys kind: ProviderConfig ``` -------------------------------- ### Install Crossplane CLI (Linux AMD64) Source: https://docs.crossplane.io/latest/guides/install-from-source Copy the Crossplane CLI binary for Linux AMD64 to your system's PATH and make it executable. ```bash sudo cp result/bin/linux_amd64/crank /usr/local/bin/crossplane chmod +x /usr/local/bin/crossplane ``` -------------------------------- ### Function Runtime Logs Source: https://docs.crossplane.io/latest/guides/write-a-composition-function-in-go Example log output from the locally running function, indicating successful execution and desired bucket creation. ```log go run . --insecure --debug 2023-10-31T16:17:32.158-0700 INFO function-xbuckets/fn.go:29 Running Function {"tag": ""} 2023-10-31T16:17:32.159-0700 INFO function-xbuckets/fn.go:125 Added desired buckets {"xr-version": "example.crossplane.io/v1", "xr-kind": "XBuckets", "xr-name": "example-buckets", "region": "us-east-2", "count": 3} ``` -------------------------------- ### Verify Crossplane CLI Installation Source: https://docs.crossplane.io/latest/guides/install-from-source Check the installed Crossplane CLI version. ```bash crossplane version ``` -------------------------------- ### Check Function Installation Source: https://docs.crossplane.io/latest/get-started/get-started-with-composition?tab=tab-1154 Verify that the Crossplane function has been successfully installed using kubectl. ```bash 1kubectl get -f fn.yaml 2NAME INSTALLED HEALTHY PACKAGE AGE 3function-pythonic True True xpkg.crossplane.io/crossplane-contrib/function-pythonic:v0.3.0 1m ``` -------------------------------- ### Check Crossplane Pod Status (Core Container Running) Source: https://docs.crossplane.io/latest/guides/pods Execute this command after the init container completes to verify the Crossplane core container is running. A '1/1 Running' status signifies successful startup. ```bash kubectl get pods -n crossplane-system crossplane-9f6d5cd7b-r9j8w 1/1 Running 0 15s ``` -------------------------------- ### Check Provider Installation Status Source: https://docs.crossplane.io/latest/guides/crossplane-with-workload-identity Commands to check the status and details of an installed Crossplane Provider. ```bash kubectl get provider provider-azure-storage kubectl describe provider provider-azure-storage ``` -------------------------------- ### Add Required Imports for Safe-Start Source: https://docs.crossplane.io/latest/guides/implementing-safe-start Include necessary packages from `k8s.io/apimachinery`, `k8s.io/apiextensions-apiserver`, and `github.com/crossplane/crossplane-runtime` for safe-start implementation. ```go import ( // existing imports... "k8s.io/apimachinery/pkg/runtime/schema" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" "github.com/crossplane/crossplane-runtime/v2/pkg/controller" "github.com/crossplane/crossplane-runtime/v2/pkg/gate" "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/customresourcesgate" ) ``` -------------------------------- ### View Installed Crossplane Pods Source: https://docs.crossplane.io/latest/get-started/install Verify the Crossplane installation by listing the pods in the 'crossplane-system' namespace. ```bash kubectl get pods -n crossplane-system NAME READY STATUS RESTARTS AGE crossplane-6d67f8cd9d-g2gjw 1/1 Running 0 26m crossplane-rbac-manager-86d9b5cf9f-2vc4s 1/1 Running 0 26m ``` -------------------------------- ### Build runtime for linux/arm64 Source: https://docs.crossplane.io/latest/guides/write-a-composition-function-in-python Build the function's runtime OCI image for the linux/arm64 platform using Docker. Ensure `binfmt` is installed if you encounter issues with cross-platform builds. ```bash docker build . --quiet --platform=linux/arm64 --tag runtime-arm64 sha256:cb015ceabf46d2a55ccaeebb11db5659a2fb5e93de36713364efcf6d699069af ``` -------------------------------- ### Verify Templated YAML Function Installation Source: https://docs.crossplane.io/latest/get-started/get-started-with-composition Check the status of the installed templated YAML composition function. ```bash kubectl get -f fn.yaml ``` -------------------------------- ### Apply provider configuration and wait for readiness Source: https://docs.crossplane.io/latest/guides/disabling-unused-managed-resources Apply the provider configuration file and then wait for the provider to become healthy. This ensures the provider is correctly installed and ready to use. ```bash kubectl apply -f provider.yaml # Wait for provider to be ready kubectl wait --for=condition=Healthy provider/provider-aws-ec2 --timeout=5m ``` -------------------------------- ### Ignore Crossplane Version Constraints for Provider Installation Source: https://docs.crossplane.io/latest/packages/providers Configure `ignoreCrossplaneConstraints: true` in a Provider manifest to install a Provider package even if the Crossplane version doesn't meet the required version. This is useful for installing providers into unsupported Crossplane versions. ```yaml apiVersion: pkg.crossplane.io/v1 kind: Provider metadata: name: crossplane-contrib-provider-aws-s3 spec: ignoreCrossplaneConstraints: true # Removed for brevity ``` -------------------------------- ### Check provider capabilities for activation support Source: https://docs.crossplane.io/latest/managed-resources/managed-resource-activation-policies Verify if a provider supports resource activation by checking its capabilities, specifically looking for 'safe-start'. ```bash # Check provider capabilities kubectl get providerrevision \ -o jsonpath='{.status.capabilities}' # Look for "safe-start" ```