github.com/oam-dev/kubevela@v1.9.11/e2e/addon/mock/testdata/fluxcd/definitions/kustomize.yaml (about)

     1  apiVersion: core.oam.dev/v1beta1
     2  kind: ComponentDefinition
     3  metadata:
     4    name: kustomize
     5    namespace: vela-system
     6    annotations:
     7      definition.oam.dev/description: "kustomize can fetching, building, updating and applying Kustomize manifests from git repo."
     8  spec:
     9    workload:
    10      type: autodetects.core.oam.dev
    11    schematic:
    12      cue:
    13        template: |
    14          output: {
    15          	apiVersion: "kustomize.toolkit.fluxcd.io/v1beta1"
    16          	kind:       "Kustomization"
    17          	metadata: {
    18          		name: context.name
    19              namespace: context.namespace
    20          	}
    21          	spec: {
    22          		interval: parameter.pullInterval
    23          		sourceRef: {
    24          			if parameter.repoType == "git" {
    25          				kind: "GitRepository"
    26          			}
    27          			if parameter.repoType == "oss" {
    28          				kind: "Bucket"
    29          			}
    30          			name:      context.name
    31          			namespace: context.namespace
    32          		}
    33          		path:       parameter.path
    34          		prune:      true
    35          		validation: "client"
    36          	}
    37          }
    38  
    39          outputs: {
    40            repo: {
    41          	  apiVersion: "source.toolkit.fluxcd.io/v1beta1"
    42          	  metadata: {
    43          		  name: context.name
    44                namespace: context.namespace
    45          	  }
    46          	  if parameter.repoType == "git" {
    47          		  kind: "GitRepository"
    48          		  spec: {
    49          			  url: parameter.url
    50          			  if parameter.git.branch != _|_ {
    51          				  ref: branch: parameter.git.branch
    52          			  }
    53                  if parameter.git.provider != _|_ {
    54                    if parameter.git.provider == "GitHub" {
    55                      gitImplementation: "go-git"
    56                    }
    57                    if parameter.git.provider == "AzureDevOps" {
    58                      gitImplementation: "libgit2"
    59                    }
    60                  }
    61          			  _secret
    62          			  _sourceCommonArgs
    63          		  }
    64          	  }
    65          	  if parameter.repoType == "oss" {
    66          		  kind: "Bucket"
    67          		  spec: {
    68          			  endpoint:   parameter.url
    69          			  bucketName: parameter.oss.bucketName
    70          			  provider:   parameter.oss.provider
    71          			  if parameter.oss.region != _|_ {
    72          				  region: parameter.oss.region
    73          			  }
    74          			  _secret
    75          			  _sourceCommonArgs
    76          		  }
    77          	  }
    78            }
    79  
    80            if parameter.imageRepository != _|_ {
    81              imageRepo: {
    82                apiVersion: "image.toolkit.fluxcd.io/v1beta1"
    83                kind: "ImageRepository"
    84          	    metadata: {
    85          		    name: context.name
    86                  namespace: context.namespace
    87          	    }
    88                spec: {
    89                  image: parameter.imageRepository.image
    90                  interval: parameter.pullInterval
    91                  if parameter.imageRepository.secretRef != _|_ {
    92                    secretRef: name: parameter.imageRepository.secretRef
    93                  }
    94                }
    95              }
    96  
    97              imagePolicy: {
    98                apiVersion: "image.toolkit.fluxcd.io/v1beta1"
    99                kind: "ImagePolicy"
   100          	    metadata: {
   101          		    name: context.name
   102                  namespace: context.namespace
   103          	    }
   104                spec: {
   105                  imageRepositoryRef: name: context.name
   106                  policy: parameter.imageRepository.policy
   107                  if parameter.imageRepository.filterTags != _|_ {
   108                    filterTags: parameter.imageRepository.filterTags
   109                  }
   110                }
   111              }
   112  
   113              imageUpdate: {
   114                apiVersion: "image.toolkit.fluxcd.io/v1beta1"
   115                kind: "ImageUpdateAutomation"
   116          	    metadata: {
   117          		    name: context.name
   118                  namespace: context.namespace
   119          	    }
   120                spec: {
   121                  interval: parameter.pullInterval
   122                  sourceRef: {
   123                    kind: "GitRepository"
   124                    name: context.name
   125                  }
   126                  git: {
   127                    checkout: ref: branch: parameter.git.branch
   128                    commit: {
   129                      author: {
   130                        email: "kubevelabot@users.noreply.github.com"
   131                        name: "kubevelabot"
   132                      }
   133                      if parameter.imageRepository.commitMessage != _|_ {
   134                        messageTemplate: "Update image automatically.\n" + parameter.imageRepository.commitMessage
   135                      }
   136                      if parameter.imageRepository.commitMessage == _|_ {
   137                        messageTemplate: "Update image automatically."
   138                      }
   139                    }
   140                    push: branch: parameter.git.branch
   141                  }
   142                  update: {
   143                    path:	parameter.path
   144                    strategy: "Setters"
   145                  }
   146                }
   147              }
   148            }
   149          }
   150  
   151          _secret: {
   152          	if parameter.secretRef != _|_ {
   153          		secretRef: {
   154          			name: parameter.secretRef
   155          		}
   156          	}
   157          }
   158  
   159          _sourceCommonArgs: {
   160          	interval: parameter.pullInterval
   161          	if parameter.timeout != _|_ {
   162          		timeout: parameter.timeout
   163          	}
   164          }
   165  
   166          parameter: {
   167          	repoType: *"git" | "oss"
   168            // +usage=The image repository for automatically update image to git
   169            imageRepository?: {
   170              // +usage=The image url
   171              image: string
   172              // +usage=The name of the secret containing authentication credentials
   173              secretRef?: string
   174              // +usage=Policy gives the particulars of the policy to be followed in selecting the most recent image.
   175              policy: {
   176                // +usage=Alphabetical set of rules to use for alphabetical ordering of the tags.
   177                alphabetical?: {
   178                  // +usage=Order specifies the sorting order of the tags.
   179                  // +usage=Given the letters of the alphabet as tags, ascending order would select Z, and descending order would select A.
   180                  order?: "asc" | "desc"
   181                }
   182                // +usage=Numerical set of rules to use for numerical ordering of the tags.
   183                numerical?: {
   184                  // +usage=Order specifies the sorting order of the tags.
   185                  // +usage=Given the integer values from 0 to 9 as tags, ascending order would select 9, and descending order would select 0.
   186                  order: "asc" | "desc"
   187                }
   188                // +usage=SemVer gives a semantic version range to check against the tags available.
   189                semver?: {
   190                  // +usage=Range gives a semver range for the image tag; the highest version within the range that's a tag yields the latest image.
   191                  range: string
   192                }
   193              }
   194              // +usage=FilterTags enables filtering for only a subset of tags based on a set of rules. If no rules are provided, all the tags from the repository will be ordered and compared.
   195              filterTags?: {
   196                // +usage=Extract allows a capture group to be extracted from the specified regular expression pattern, useful before tag evaluation.
   197                extract?: string
   198                // +usage=Pattern specifies a regular expression pattern used to filter for image tags.
   199                pattern?: string
   200              }
   201              // +usage=The image url
   202              commitMessage?: string
   203            }
   204          	// +usage=The interval at which to check for repository/bucket and release updates, default to 5m
   205          	pullInterval: *"5m" | string
   206          	// +usage=The Git or Helm repository URL, OSS endpoint, accept HTTP/S or SSH address as git url,
   207          	url: string
   208          	// +usage=The name of the secret containing authentication credentials
   209          	secretRef?: string
   210          	// +usage=The timeout for operations like download index/clone repository, optional
   211          	timeout?: string
   212          	git?: {
   213          		// +usage=The Git reference to checkout and monitor for changes, defaults to master branch
   214          		branch: string
   215              // +usage=Determines which git client library to use. Defaults to GitHub, it will pick go-git. AzureDevOps will pick libgit2.
   216              provider?: *"GitHub" | "AzureDevOps"
   217          	}
   218          	oss?: {
   219          		// +usage=The bucket's name, required if repoType is oss
   220          		bucketName: string
   221          		// +usage="generic" for Minio, Amazon S3, Google Cloud Storage, Alibaba Cloud OSS, "aws" for retrieve credentials from the EC2 service when credentials not specified, default "generic"
   222          		provider: *"generic" | "aws"
   223          		// +usage=The bucket region, optional
   224          		region?: string
   225          	}
   226          	//+usage=Path to the directory containing the kustomization.yaml file, or the set of plain YAMLs a kustomization.yaml should be generated for.
   227          	path: string
   228          }