├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── backport.yml │ ├── ci.yml │ ├── commands.yml │ ├── promote.yml │ ├── stale.yml │ └── tag.yml ├── .gitignore ├── .gitmodules ├── .golangci.yml ├── CODE_OF_CONDUCT.md ├── DCO ├── INSTALL.md ├── LICENSE ├── MOCK_GENERATION.md ├── Makefile ├── OWNERS.md ├── PROJECT ├── README.md ├── apis ├── cluster │ ├── applications │ │ └── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── register.go │ │ │ ├── status.go │ │ │ ├── types.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ ├── zz_generated.managedlist.go │ │ │ └── zz_generated.resolvers.go │ ├── applicationsets │ │ └── v1alpha1 │ │ │ ├── application_types.go │ │ │ ├── doc.go │ │ │ ├── register.go │ │ │ ├── status.go │ │ │ ├── types.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ ├── zz_generated.managedlist.go │ │ │ └── zz_generated.resolvers.go │ ├── cluster │ │ └── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── referencers.go │ │ │ ├── register.go │ │ │ ├── types.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ └── zz_generated.managedlist.go │ ├── projects │ │ └── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── register.go │ │ │ ├── token.go │ │ │ ├── types.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ ├── zz_generated.managedlist.go │ │ │ └── zz_generated.resolvers.go │ ├── register.go │ ├── repositories │ │ └── v1alpha1 │ │ │ ├── doc.go │ │ │ ├── register.go │ │ │ ├── types.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ └── zz_generated.managedlist.go │ └── v1alpha1 │ │ ├── doc.go │ │ ├── providerconfig_types.go │ │ ├── register.go │ │ ├── zz_generated.deepcopy.go │ │ ├── zz_generated.pc.go │ │ ├── zz_generated.pcu.go │ │ └── zz_generated.pculist.go ├── generate.go ├── namespace │ ├── applications │ │ └── v1alpha1 │ │ │ ├── application_types.go │ │ │ ├── register.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ ├── zz_generated.managedlist.go │ │ │ ├── zz_generated.resolvers.go │ │ │ └── zz_generated.types.copied.go │ ├── applicationsets │ │ └── v1alpha1 │ │ │ ├── applicationset_types.go │ │ │ ├── register.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ ├── zz_generated.managedlist.go │ │ │ ├── zz_generated.resolvers.go │ │ │ └── zz_generated.types.copied.go │ ├── cluster │ │ └── v1alpha1 │ │ │ ├── cluster_types.go │ │ │ ├── referencers.go │ │ │ ├── register.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ ├── zz_generated.managedlist.go │ │ │ └── zz_generated.types.copied.go │ ├── projects │ │ └── v1alpha1 │ │ │ ├── project_types.go │ │ │ ├── register.go │ │ │ ├── token_types.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ ├── zz_generated.managedlist.go │ │ │ ├── zz_generated.project_types.copied.go │ │ │ ├── zz_generated.resolvers.go │ │ │ └── zz_generated.token_types.copied.go │ ├── register.go │ ├── repositories │ │ └── v1alpha1 │ │ │ ├── register.go │ │ │ ├── repository_types.go │ │ │ ├── zz_generated.deepcopy.go │ │ │ ├── zz_generated.managed.go │ │ │ ├── zz_generated.managedlist.go │ │ │ └── zz_generated.repository_types.copied.go │ └── v1alpha1 │ │ ├── providerconfig_types.go │ │ ├── register.go │ │ ├── zz_generated.deepcopy.go │ │ ├── zz_generated.pc.go │ │ ├── zz_generated.pcu.go │ │ └── zz_generated.pculist.go └── register.go ├── cluster ├── images │ └── provider-argocd │ │ ├── Dockerfile │ │ └── Makefile └── local │ └── integration_tests.sh ├── cmd └── provider │ └── main.go ├── examples ├── application │ ├── application-kubeconfig.yaml │ ├── application-with-annotations.yaml │ ├── application-with-finalizers.yaml │ ├── application-with-references.yaml │ └── application.yaml ├── applicationset │ ├── applicationset-with-ref.yaml │ └── applicationset.yaml ├── cluster │ ├── cluster-kubeconfig.yaml │ └── cluster.yaml ├── projects │ ├── project-with-source-namespaces.yaml │ ├── project.yaml │ └── token.yaml ├── providerconfig │ └── provider.yaml └── repositories │ └── repository.yaml ├── go.mod ├── go.sum ├── hack ├── boilerplate.go.txt ├── helpers │ ├── addtype.sh │ ├── apis │ │ └── GROUP_LOWER │ │ │ ├── APIVERSION │ │ │ ├── KIND_LOWER_types.go.tmpl │ │ │ ├── doc.go.tmpl │ │ │ └── groupversion_info.go.tmpl │ │ │ └── GROUP_LOWER.go.tmpl │ └── controller │ │ └── KIND_LOWER │ │ ├── KIND_LOWER.go.tmpl │ │ └── KIND_LOWER_test.go.tmpl ├── linter-violation.tmpl └── local-argocd-setup.sh ├── package ├── crds │ ├── applications.argocd.crossplane.io_applications.yaml │ ├── applications.m.argocd.crossplane.io_applications.yaml │ ├── applicationsets.argocd.crossplane.io_applicationsets.yaml │ ├── applicationsets.m.argocd.crossplane.io_applicationsets.yaml │ ├── argocd.crossplane.io_providerconfigs.yaml │ ├── argocd.crossplane.io_providerconfigusages.yaml │ ├── cluster.argocd.crossplane.io_clusters.yaml │ ├── cluster.m.argocd.crossplane.io_clusters.yaml │ ├── m.argocd.crossplane.io_providerconfigs.yaml │ ├── m.argocd.crossplane.io_providerconfigusages.yaml │ ├── projects.argocd.crossplane.io_projects.yaml │ ├── projects.argocd.crossplane.io_tokens.yaml │ ├── projects.m.argocd.crossplane.io_projects.yaml │ ├── projects.m.argocd.crossplane.io_tokens.yaml │ ├── repositories.argocd.crossplane.io_repositories.yaml │ └── repositories.m.argocd.crossplane.io_repositories.yaml └── crossplane.yaml ├── pkg ├── clients │ ├── cluster │ │ ├── argocd.go │ │ └── converter │ │ │ ├── applications │ │ │ ├── conversions.go │ │ │ └── zz_generated.conversion.go │ │ │ ├── applicationsets │ │ │ ├── conversions.go │ │ │ └── zz_generated.conversion.go │ │ │ └── generate.go │ ├── generate.go │ ├── interface │ │ ├── applications │ │ │ └── client.go │ │ ├── applicationsets │ │ │ └── client.go │ │ ├── cluster │ │ │ └── client.go │ │ ├── clusters │ │ │ └── client.go │ │ ├── mock │ │ │ ├── applications │ │ │ │ └── mock.go │ │ │ ├── applicationsets │ │ │ │ └── mock.go │ │ │ ├── cluster │ │ │ │ └── mock.go │ │ │ ├── generate.go │ │ │ ├── projects │ │ │ │ └── mock.go │ │ │ └── repositories │ │ │ │ └── mock.go │ │ ├── projects │ │ │ └── client.go │ │ └── repositories │ │ │ └── client.go │ └── namespace │ │ ├── argocd_namespace.go │ │ ├── converter │ │ ├── applications │ │ │ ├── zz_generated.conversion.go │ │ │ └── zz_generated.copied.conversions.go │ │ ├── applicationsets │ │ │ ├── zz_generated.conversion.go │ │ │ └── zz_generated.copied.conversions.go │ │ └── generate.go │ │ └── pointer.go ├── controller │ ├── cluster │ │ ├── applications │ │ │ ├── comp.go │ │ │ ├── comp_test.go │ │ │ ├── controller.go │ │ │ └── controller_test.go │ │ ├── applicationsets │ │ │ ├── comp.go │ │ │ ├── controller.go │ │ │ └── controller_test.go │ │ ├── cluster │ │ │ ├── controller.go │ │ │ └── controller_test.go │ │ ├── config │ │ │ └── config.go │ │ ├── projects │ │ │ ├── controller.go │ │ │ └── controller_test.go │ │ ├── repositories │ │ │ ├── controller.go │ │ │ └── controller_test.go │ │ ├── setup.go │ │ └── tokens │ │ │ ├── controller.go │ │ │ └── controller_test.go │ ├── doc.go │ ├── namespace │ │ ├── applications │ │ │ ├── generate.go │ │ │ ├── zz_generated.copied.comp.go │ │ │ ├── zz_generated.copied.comp_test.go │ │ │ ├── zz_generated.copied.controller.go │ │ │ └── zz_generated.copied.controller_test.go │ │ ├── applicationsets │ │ │ ├── generate.go │ │ │ ├── zz_generated.copied.comp.go │ │ │ ├── zz_generated.copied.controller.go │ │ │ └── zz_generated.copied.controller_test.go │ │ ├── cluster │ │ │ ├── generate.go │ │ │ ├── zz_generated.copied.controller.go │ │ │ └── zz_generated.copied.controller_test.go │ │ ├── config │ │ │ └── config.go │ │ ├── projects │ │ │ ├── generate.go │ │ │ ├── zz_generated.copied.controller.go │ │ │ └── zz_generated.copied.controller_test.go │ │ ├── repositories │ │ │ ├── generate.go │ │ │ ├── zz_generated.copied.controller.go │ │ │ └── zz_generated.copied.controller_test.go │ │ ├── setup.go │ │ └── tokens │ │ │ ├── generate.go │ │ │ ├── zz_generated.copied.controller.go │ │ │ └── zz_generated.copied.controller_test.go │ └── setup.go ├── features │ └── features.go └── version │ └── version.go └── tools ├── generate.go ├── go.mod └── go.sum /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | charset = utf-8 6 | trim_trailing_whitespace = true 7 | indent_style = space 8 | indent_size = 2 9 | 10 | [{Makefile,go.mod,go.sum,*.go,.gitmodules}] 11 | indent_style = tab 12 | indent_size = 4 13 | 14 | [*.md] 15 | indent_size = 4 16 | trim_trailing_whitespace = false 17 | 18 | [Dockerfile] 19 | indent_size = 4 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Help us diagnose and fix bugs in Crossplane Provider argocd 4 | labels: bug 5 | --- 6 | 13 | 14 | ### What happened? 15 | 19 | 20 | 21 | ### How can we reproduce it? 22 | 27 | 28 | ### What environment did it happen in? 29 | Crossplane version: 30 | Crossplane Provider argocd version: 31 | 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Help us make Crossplane Provider argocd more useful 4 | labels: enhancement 5 | --- 6 | 13 | 14 | ### What problem are you facing? 15 | 20 | 21 | ### How could Crossplane help solve your problem? 22 | 25 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | ### Description of your changes 10 | 11 | 20 | Fixes # 21 | 22 | I have: 23 | 24 | - [ ] Read and followed Crossplane's [contribution process]. 25 | - [ ] Run `make reviewable test` to ensure this PR is ready for review. 26 | 27 | ### How has this code been tested 28 | 29 | 34 | 35 | [contribution process]: https://git.io/fj2m9 36 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Please see the documentation for all configuration options: 2 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 3 | 4 | version: 2 5 | updates: 6 | - package-ecosystem: "gomod" 7 | directory: "/" 8 | schedule: 9 | interval: "daily" -------------------------------------------------------------------------------- /.github/workflows/backport.yml: -------------------------------------------------------------------------------- 1 | name: Backport 2 | 3 | on: 4 | # NOTE(negz): This is a risky target, but we run this action only when and if 5 | # a PR is closed, then filter down to specifically merged PRs. We also don't 6 | # invoke any scripts, etc from within the repo. I believe the fact that we'll 7 | # be able to review PRs before this runs makes this fairly safe. 8 | # https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ 9 | pull_request_target: 10 | types: [closed] 11 | # See also commands.yml for the /backport triggered variant of this workflow. 12 | 13 | jobs: 14 | # NOTE(negz): I tested many backport GitHub actions before landing on this 15 | # one. Many do not support merge commits, or do not support pull requests with 16 | # more than one commit. This one does. It also handily links backport PRs with 17 | # new PRs, and provides commentary and instructions when it can't backport. 18 | # The main gotchas with this action are that it _only_ supports merge commits, 19 | # and that PRs _must_ be labelled before they're merged to trigger a backport. 20 | open-pr: 21 | runs-on: ubuntu-22.04 22 | if: github.event.pull_request.merged 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 26 | with: 27 | fetch-depth: 0 28 | 29 | - name: Open Backport PR 30 | uses: zeebe-io/backport-action@v0.0.4 31 | with: 32 | github_token: ${{ secrets.GITHUB_TOKEN }} 33 | github_workspace: ${{ github.workspace }} 34 | version: v0.0.4 35 | -------------------------------------------------------------------------------- /.github/workflows/commands.yml: -------------------------------------------------------------------------------- 1 | name: Comment Commands 2 | 3 | on: issue_comment 4 | 5 | jobs: 6 | # NOTE(negz): See also backport.yml, which is the variant that triggers on PR 7 | # merge rather than on comment. 8 | backport: 9 | runs-on: ubuntu-20.04 10 | if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/backport') 11 | steps: 12 | - name: Extract Command 13 | id: command 14 | uses: xt0rted/slash-command-action@v1 15 | with: 16 | repo-token: ${{ secrets.GITHUB_TOKEN }} 17 | command: backport 18 | reaction: "true" 19 | reaction-type: "eyes" 20 | allow-edits: "false" 21 | permission-level: write 22 | 23 | - name: Checkout 24 | uses: actions/checkout@v2 25 | with: 26 | fetch-depth: 0 27 | 28 | - name: Open Backport PR 29 | uses: zeebe-io/backport-action@v0.0.4 30 | with: 31 | github_token: ${{ secrets.GITHUB_TOKEN }} 32 | github_workspace: ${{ github.workspace }} 33 | version: v0.0.4 34 | 35 | fresh: 36 | runs-on: ubuntu-20.04 37 | if: startsWith(github.event.comment.body, '/fresh') 38 | 39 | steps: 40 | - name: Extract Command 41 | id: command 42 | uses: xt0rted/slash-command-action@v1 43 | with: 44 | repo-token: ${{ secrets.GITHUB_TOKEN }} 45 | command: fresh 46 | reaction: "true" 47 | reaction-type: "eyes" 48 | allow-edits: "false" 49 | permission-level: read 50 | - name: Handle Command 51 | uses: actions-ecosystem/action-remove-labels@v1 52 | with: 53 | github_token: ${{ secrets.GITHUB_TOKEN }} 54 | labels: stale 55 | -------------------------------------------------------------------------------- /.github/workflows/promote.yml: -------------------------------------------------------------------------------- 1 | name: Promote 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: 'Release version (e.g. v0.1.0)' 8 | required: true 9 | channel: 10 | description: 'Release channel' 11 | required: true 12 | default: 'alpha' 13 | 14 | env: 15 | # Common versions 16 | GO_VERSION: '1.19' 17 | 18 | # Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run 19 | # a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether 20 | # credentials have been provided before trying to run steps that need them. 21 | CONTRIB_DOCKER_USR: ${{ secrets.CONTRIB_DOCKER_USR }} 22 | AWS_USR: ${{ secrets.AWS_USR }} 23 | 24 | jobs: 25 | promote-artifacts: 26 | runs-on: ubuntu-20.04 27 | 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@v2 31 | with: 32 | submodules: true 33 | 34 | - name: Setup Go 35 | uses: actions/setup-go@v2 36 | with: 37 | go-version: ${{ env.GO_VERSION }} 38 | 39 | - name: Fetch History 40 | run: git fetch --prune --unshallow 41 | 42 | - name: Login to Docker 43 | uses: docker/login-action@v1 44 | if: env.CONTRIB_DOCKER_USR != '' 45 | with: 46 | username: ${{ secrets.CONTRIB_DOCKER_USR }} 47 | password: ${{ secrets.CONTRIB_DOCKER_PSW }} 48 | 49 | - name: Promote Artifacts in S3 and Docker Hub 50 | if: env.AWS_USR != '' && env.CONTRIB_DOCKER_USR != '' 51 | run: make -j2 promote BRANCH_NAME=${GITHUB_REF##*/} 52 | env: 53 | VERSION: ${{ github.event.inputs.version }} 54 | CHANNEL: ${{ github.event.inputs.channel }} 55 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} 56 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} 57 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Stale Issues and PRs 2 | on: 3 | schedule: 4 | # Process new stale issues once a day. Folks can /fresh for a fast un-stale 5 | # per the commands workflow. Run at 1:15 mostly as a somewhat unique time to 6 | # help correlate any issues with this workflow. 7 | - cron: '15 1 * * *' 8 | workflow_dispatch: {} 9 | 10 | permissions: 11 | issues: write 12 | pull-requests: write 13 | 14 | jobs: 15 | stale: 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - uses: actions/stale@v5 19 | with: 20 | # This action uses ~2 operations per stale issue per run to determine 21 | # whether it's still stale. It also uses 2-3 operations to mark an issue 22 | # stale or not. During steady state (no issues to mark stale, check, or 23 | # close) we seem to use less than 10 operations with ~150 issues and PRs 24 | # open. 25 | # 26 | # Our hourly rate-limit budget for all workflows that use GITHUB_TOKEN 27 | # is 1,000 requests per the below docs. 28 | # https://docs.github.com/en/rest/overview/resources-in-the-rest-api#requests-from-github-actions 29 | operations-per-run: 100 30 | days-before-stale: 90 31 | days-before-close: 7 32 | stale-issue-label: stale 33 | exempt-issue-labels: exempt-from-stale 34 | stale-issue-message: > 35 | Crossplane does not currently have enough maintainers to address every 36 | issue and pull request. This issue has been automatically marked as 37 | `stale` because it has had no activity in the last 90 days. It will be 38 | closed in 7 days if no further activity occurs. Leaving a comment 39 | **starting with** `/fresh` will mark this issue as not stale. 40 | stale-pr-label: stale 41 | exempt-pr-labels: exempt-from-stale 42 | stale-pr-message: 43 | Crossplane does not currently have enough maintainers to address every 44 | issue and pull request. This pull request has been automatically 45 | marked as `stale` because it has had no activity in the last 90 days. 46 | It will be closed in 7 days if no further activity occurs. 47 | closed in 7 days if no further activity occurs. Adding a comment 48 | **starting with** `/fresh` will mark this PR as not stale. 49 | -------------------------------------------------------------------------------- /.github/workflows/tag.yml: -------------------------------------------------------------------------------- 1 | name: Tag 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: 'Release version (e.g. v0.1.0)' 8 | required: true 9 | message: 10 | description: 'Tag message' 11 | required: true 12 | 13 | jobs: 14 | create-tag: 15 | runs-on: ubuntu-22.04 16 | 17 | steps: 18 | - name: Checkout 19 | uses: actions/checkout@v2 20 | 21 | - name: Create Tag 22 | uses: negz/create-tag@v1 23 | with: 24 | version: ${{ github.event.inputs.version }} 25 | message: ${{ github.event.inputs.message }} 26 | token: ${{ secrets.GITHUB_TOKEN }} 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.cache 2 | /.work 3 | /_output 4 | cover.out 5 | /vendor 6 | /.vendor-new 7 | 8 | # asdf loca go version 9 | .tool-versions 10 | 11 | # ignore IDE folders 12 | .vscode/ 13 | .idea/ 14 | # Ignore kubeconfig generated by `make dev-debug` 15 | kubeconfig 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "build"] 2 | path = build 3 | url = https://github.com/crossplane/build.git 4 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | linters: 3 | enable: 4 | - asasalint 5 | - asciicheck 6 | - bidichk 7 | - bodyclose 8 | - contextcheck 9 | - durationcheck 10 | - errchkjson 11 | - errorlint 12 | - exhaustive 13 | - gocheckcompilerdirectives 14 | - gochecksumtype 15 | - goconst 16 | - gocritic 17 | - gocyclo 18 | - gosec 19 | - gosmopolitan 20 | - loggercheck 21 | - makezero 22 | - misspell 23 | - musttag 24 | - nakedret 25 | - nilerr 26 | - nilnesserr 27 | - noctx 28 | - nolintlint 29 | - prealloc 30 | - protogetter 31 | - reassign 32 | - recvcheck 33 | - revive 34 | - rowserrcheck 35 | - spancheck 36 | - sqlclosecheck 37 | - testifylint 38 | - unconvert 39 | - unparam 40 | - zerologlint 41 | settings: 42 | dupl: 43 | threshold: 100 44 | errcheck: 45 | check-type-assertions: false 46 | check-blank: false 47 | goconst: 48 | min-len: 3 49 | min-occurrences: 5 50 | gocritic: 51 | enabled-tags: 52 | - performance 53 | settings: 54 | captLocal: 55 | paramsOnly: true 56 | rangeValCopy: 57 | sizeThreshold: 32 58 | gocyclo: 59 | min-complexity: 10 60 | lll: 61 | tab-width: 1 62 | nakedret: 63 | max-func-lines: 30 64 | nolintlint: 65 | require-explanation: false 66 | require-specific: true 67 | prealloc: 68 | simple: true 69 | range-loops: true 70 | for-loops: false 71 | revive: 72 | rules: 73 | - name: package-comments 74 | disabled: true 75 | staticcheck: 76 | checks: 77 | - -QF1008 78 | unparam: 79 | check-exported: false 80 | exclusions: 81 | generated: lax 82 | rules: 83 | - linters: 84 | - dupl 85 | - errcheck 86 | - gocyclo 87 | - gosec 88 | - scopelint 89 | - unparam 90 | path: _test(ing)?\.go 91 | - linters: 92 | - gocritic 93 | path: _test\.go 94 | text: (unnamedResult|exitAfterDefer) 95 | - linters: 96 | - gocritic 97 | text: '(hugeParam|rangeValCopy):' 98 | - linters: 99 | - staticcheck 100 | text: 'SA3000:' 101 | - linters: 102 | - gosec 103 | text: 'G101:' 104 | - linters: 105 | - gosec 106 | text: 'G104:' 107 | - linters: 108 | - musttag 109 | path: k8s.io/ 110 | paths: 111 | - third_party$ 112 | - builtin$ 113 | - examples$ 114 | issues: 115 | max-same-issues: 0 116 | new: false 117 | formatters: 118 | enable: 119 | - gci 120 | - gofmt 121 | settings: 122 | gci: 123 | sections: 124 | - standard 125 | - default 126 | - prefix(github.com/crossplane-contrib/provider-argocd) 127 | custom-order: true 128 | gofmt: 129 | simplify: true 130 | exclusions: 131 | generated: lax 132 | paths: 133 | - third_party$ 134 | - builtin$ 135 | - examples$ 136 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Community Code of Conduct 2 | 3 | This project follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). 4 | -------------------------------------------------------------------------------- /DCO: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 660 York Street, Suite 102, 6 | San Francisco, CA 94110 USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this 9 | license document, but changing it is not allowed. 10 | 11 | 12 | Developer's Certificate of Origin 1.1 13 | 14 | By making a contribution to this project, I certify that: 15 | 16 | (a) The contribution was created in whole or in part by me and I 17 | have the right to submit it under the open source license 18 | indicated in the file; or 19 | 20 | (b) The contribution is based upon previous work that, to the best 21 | of my knowledge, is covered under an appropriate open source 22 | license and I have the right under that license to submit that 23 | work with modifications, whether created in whole or in part 24 | by me, under the same open source license (unless I am 25 | permitted to submit under a different license), as indicated 26 | in the file; or 27 | 28 | (c) The contribution was provided directly to me by some other 29 | person who certified (a), (b) or (c) and I have not modified 30 | it. 31 | 32 | (d) I understand and agree that this project and the contribution 33 | are public and that a record of the contribution (including all 34 | personal information I submit with it, including my sign-off) is 35 | maintained indefinitely and may be redistributed consistent with 36 | this project or the open source license(s) involved. 37 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # Building and Installing the Crossplane argocd Provider 2 | 3 | `provider-argocd` is composed of a golang project and can be built directly with 4 | standard `golang` tools. We currently support two different platforms for 5 | building: 6 | 7 | * Linux: most modern distros should work although most testing has been done on 8 | Ubuntu 9 | * Mac: macOS 10.6+ is supported 10 | 11 | ## Build Requirements 12 | 13 | An Intel-based machine (recommend 2+ cores, 2+ GB of memory and 128GB of SSD). 14 | Inside your build environment (Docker for Mac or a VM), 6+ GB memory is also 15 | recommended. 16 | 17 | The following tools are need on the host: 18 | 19 | * curl 20 | * docker (1.12+) or Docker for Mac (17+) 21 | * git 22 | * make 23 | * golang 24 | * rsync (if you're using the build container on mac) 25 | * helm (v2.8.2+) 26 | * kubebuilder (v1.0.4+) 27 | 28 | ## Build 29 | 30 | You can build the Crossplane argocd Provider for the host platform by 31 | simply running the command below. Building in parallel with the `-j` option is 32 | recommended. 33 | 34 | ```console 35 | make -j4 36 | ``` 37 | 38 | The first time `make` is run, the build submodule will be synced and updated. 39 | After initial setup, it can be updated by running `make submodules`. 40 | 41 | Run `make help` for more options. 42 | 43 | ## Building inside the cross container 44 | 45 | Official Crossplane builds are done inside a build container. This ensures that 46 | we get a consistent build, test and release environment. To run the build inside 47 | the cross container run: 48 | 49 | ```console 50 | > build/run make -j4 51 | ``` 52 | 53 | The first run of `build/run` will build the container itself and could take a 54 | few minutes to complete, but subsequent builds should go much faster. 55 | -------------------------------------------------------------------------------- /MOCK_GENERATION.md: -------------------------------------------------------------------------------- 1 | # Client Mock Generation 2 | 3 | [go-mock](https://go.uber.org/mock) is used to generate mocks of the ArgoCD client. 4 | 5 | ## Install 6 | 7 | Follow the [installation instructions](https://go.uber.org/mock#installation) to get the latest version. 8 | 9 | ## Generate mocks 10 | 11 | The following example shows how to generate mocks for the `projects` API: 12 | 13 | MOCK_API="projects" 14 | MOCK_INTERFACE="ProjectServiceClient" 15 | 16 | mockgen -package $MOCK_API -destination pkg/clients/mock/$MOCK_API/mock.go github.com/crossplane-contrib/provider-argocd/pkg/clients/$MOCK_API $MOCK_INTERFACE 17 | 18 | ## go:generate 19 | 20 | To automatically regenerate mocks, extend `pkg/clients/generate.go`. 21 | -------------------------------------------------------------------------------- /OWNERS.md: -------------------------------------------------------------------------------- 1 | # OWNERS 2 | 3 | This page lists all maintainers for **this** repository. Each repository in the [Crossplane 4 | organization](https://github.com/crossplane/) will list their repository maintainers in their own 5 | `OWNERS.md` file. 6 | 7 | Please see the Crossplane 8 | [GOVERNANCE.md](https://github.com/crossplane/crossplane/blob/master/GOVERNANCE.md) for governance 9 | guidelines and responsibilities for the steering committee and maintainers. 10 | 11 | ## Maintainers 12 | 13 | * Jan Willies ([janwillies](https://github.com/janwillies)) 14 | * Maximilian Blatt ([MisterMX](https://github.com/MisterMX)) 15 | * Ana Garlau ([anagarlau](https://github.com/anagarlau)) 16 | * Christopher Junk ([christophrj](https://github.com/christophrj)) 17 | * Nico Andres ([AndresNico](https://github.com/AndresNico)) 18 | * Kevin Kendzia ([kkendzia](https://github.com/kkendzia)) 19 | * Gosha Khromov ([ggkhrmv](https://github.com/ggkhrmv)) -------------------------------------------------------------------------------- /PROJECT: -------------------------------------------------------------------------------- 1 | version: "1" 2 | domain: crossplane.io 3 | repo: github.com/crossplane-contrib/provider-argocd 4 | -------------------------------------------------------------------------------- /apis/cluster/applications/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=applications.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | -------------------------------------------------------------------------------- /apis/cluster/applications/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | "k8s.io/apimachinery/pkg/runtime/schema" 23 | "sigs.k8s.io/controller-runtime/pkg/scheme" 24 | ) 25 | 26 | // Package type metadata. 27 | const ( 28 | Group = "applications.argocd.crossplane.io" 29 | Version = "v1alpha1" 30 | ) 31 | 32 | var ( 33 | // SchemeGroupVersion is group version used to register these objects 34 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 35 | 36 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 37 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 38 | ) 39 | 40 | // Application type metadata 41 | var ( 42 | ApplicationKind = reflect.TypeOf(Application{}).Name() 43 | ApplicationGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationKind}.String() 44 | ApplicationKindAPIVersion = ApplicationKind + "." + SchemeGroupVersion.String() 45 | ApplicationGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationKind) 46 | ) 47 | 48 | func init() { 49 | SchemeBuilder.Register(&Application{}, &ApplicationList{}) 50 | } 51 | -------------------------------------------------------------------------------- /apis/cluster/applications/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this Application. 24 | func (mg *Application) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetDeletionPolicy of this Application. 29 | func (mg *Application) GetDeletionPolicy() xpv1.DeletionPolicy { 30 | return mg.Spec.DeletionPolicy 31 | } 32 | 33 | // GetManagementPolicies of this Application. 34 | func (mg *Application) GetManagementPolicies() xpv1.ManagementPolicies { 35 | return mg.Spec.ManagementPolicies 36 | } 37 | 38 | // GetProviderConfigReference of this Application. 39 | func (mg *Application) GetProviderConfigReference() *xpv1.Reference { 40 | return mg.Spec.ProviderConfigReference 41 | } 42 | 43 | // GetWriteConnectionSecretToReference of this Application. 44 | func (mg *Application) GetWriteConnectionSecretToReference() *xpv1.SecretReference { 45 | return mg.Spec.WriteConnectionSecretToReference 46 | } 47 | 48 | // SetConditions of this Application. 49 | func (mg *Application) SetConditions(c ...xpv1.Condition) { 50 | mg.Status.SetConditions(c...) 51 | } 52 | 53 | // SetDeletionPolicy of this Application. 54 | func (mg *Application) SetDeletionPolicy(r xpv1.DeletionPolicy) { 55 | mg.Spec.DeletionPolicy = r 56 | } 57 | 58 | // SetManagementPolicies of this Application. 59 | func (mg *Application) SetManagementPolicies(r xpv1.ManagementPolicies) { 60 | mg.Spec.ManagementPolicies = r 61 | } 62 | 63 | // SetProviderConfigReference of this Application. 64 | func (mg *Application) SetProviderConfigReference(r *xpv1.Reference) { 65 | mg.Spec.ProviderConfigReference = r 66 | } 67 | 68 | // SetWriteConnectionSecretToReference of this Application. 69 | func (mg *Application) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { 70 | mg.Spec.WriteConnectionSecretToReference = r 71 | } 72 | -------------------------------------------------------------------------------- /apis/cluster/applications/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ApplicationList. 24 | func (l *ApplicationList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/cluster/applicationsets/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=applicationsets.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | -------------------------------------------------------------------------------- /apis/cluster/applicationsets/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | "k8s.io/apimachinery/pkg/runtime/schema" 23 | "sigs.k8s.io/controller-runtime/pkg/scheme" 24 | ) 25 | 26 | // Package type metadata. 27 | const ( 28 | Group = "applicationsets.argocd.crossplane.io" 29 | Version = "v1alpha1" 30 | ) 31 | 32 | var ( 33 | // SchemeGroupVersion is group version used to register these objects 34 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 35 | 36 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 37 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 38 | ) 39 | 40 | // ApplicationSet type metadata. 41 | var ( 42 | ApplicationSetKind = reflect.TypeOf(ApplicationSet{}).Name() 43 | ApplicationSetGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationSetKind}.String() 44 | ApplicationSetKindAPIVersion = ApplicationSetKind + "." + SchemeGroupVersion.String() 45 | ApplicationSetGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationSetKind) 46 | ) 47 | 48 | func init() { 49 | SchemeBuilder.Register(&ApplicationSet{}, &ApplicationSetList{}) 50 | } 51 | -------------------------------------------------------------------------------- /apis/cluster/applicationsets/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this ApplicationSet. 24 | func (mg *ApplicationSet) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetDeletionPolicy of this ApplicationSet. 29 | func (mg *ApplicationSet) GetDeletionPolicy() xpv1.DeletionPolicy { 30 | return mg.Spec.DeletionPolicy 31 | } 32 | 33 | // GetManagementPolicies of this ApplicationSet. 34 | func (mg *ApplicationSet) GetManagementPolicies() xpv1.ManagementPolicies { 35 | return mg.Spec.ManagementPolicies 36 | } 37 | 38 | // GetProviderConfigReference of this ApplicationSet. 39 | func (mg *ApplicationSet) GetProviderConfigReference() *xpv1.Reference { 40 | return mg.Spec.ProviderConfigReference 41 | } 42 | 43 | // GetWriteConnectionSecretToReference of this ApplicationSet. 44 | func (mg *ApplicationSet) GetWriteConnectionSecretToReference() *xpv1.SecretReference { 45 | return mg.Spec.WriteConnectionSecretToReference 46 | } 47 | 48 | // SetConditions of this ApplicationSet. 49 | func (mg *ApplicationSet) SetConditions(c ...xpv1.Condition) { 50 | mg.Status.SetConditions(c...) 51 | } 52 | 53 | // SetDeletionPolicy of this ApplicationSet. 54 | func (mg *ApplicationSet) SetDeletionPolicy(r xpv1.DeletionPolicy) { 55 | mg.Spec.DeletionPolicy = r 56 | } 57 | 58 | // SetManagementPolicies of this ApplicationSet. 59 | func (mg *ApplicationSet) SetManagementPolicies(r xpv1.ManagementPolicies) { 60 | mg.Spec.ManagementPolicies = r 61 | } 62 | 63 | // SetProviderConfigReference of this ApplicationSet. 64 | func (mg *ApplicationSet) SetProviderConfigReference(r *xpv1.Reference) { 65 | mg.Spec.ProviderConfigReference = r 66 | } 67 | 68 | // SetWriteConnectionSecretToReference of this ApplicationSet. 69 | func (mg *ApplicationSet) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { 70 | mg.Spec.WriteConnectionSecretToReference = r 71 | } 72 | -------------------------------------------------------------------------------- /apis/cluster/applicationsets/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ApplicationSetList. 24 | func (l *ApplicationSetList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/cluster/cluster/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=cluster.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | -------------------------------------------------------------------------------- /apis/cluster/cluster/v1alpha1/referencers.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "github.com/crossplane/crossplane-runtime/v2/pkg/reference" 5 | "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 6 | ) 7 | 8 | // ServerName returns the Spec.ForProvider.Name of an Cluster. 9 | func ServerName() reference.ExtractValueFn { 10 | return func(mg resource.Managed) string { 11 | r, ok := mg.(*Cluster) 12 | if !ok { 13 | return "" 14 | } 15 | if r.Spec.ForProvider.Name == nil { 16 | return "" 17 | } 18 | return *r.Spec.ForProvider.Name 19 | } 20 | } 21 | 22 | // ServerAddress returns the Spec.ForProvider.Server of a Cluster 23 | func ServerAddress() reference.ExtractValueFn { 24 | return func(mg resource.Managed) string { 25 | r, ok := mg.(*Cluster) 26 | if !ok { 27 | return "" 28 | } 29 | if r.Spec.ForProvider.Server == nil { 30 | return "" 31 | } 32 | return *r.Spec.ForProvider.Server 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /apis/cluster/cluster/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | "k8s.io/apimachinery/pkg/runtime/schema" 23 | "sigs.k8s.io/controller-runtime/pkg/scheme" 24 | ) 25 | 26 | // Package type metadata. 27 | const ( 28 | Group = "cluster.argocd.crossplane.io" 29 | Version = "v1alpha1" 30 | ) 31 | 32 | var ( 33 | // SchemeGroupVersion is group version used to register these objects 34 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 35 | 36 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 37 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 38 | ) 39 | 40 | // Cluster type metadata 41 | var ( 42 | ClusterKind = reflect.TypeOf(Cluster{}).Name() 43 | ClusterGroupKind = schema.GroupKind{Group: Group, Kind: ClusterKind}.String() 44 | ClusterKindAPIVersion = ClusterKind + "." + SchemeGroupVersion.String() 45 | ClusterGroupVersionKind = SchemeGroupVersion.WithKind(ClusterKind) 46 | ) 47 | 48 | func init() { 49 | SchemeBuilder.Register(&Cluster{}, &ClusterList{}) 50 | } 51 | -------------------------------------------------------------------------------- /apis/cluster/cluster/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this Cluster. 24 | func (mg *Cluster) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetDeletionPolicy of this Cluster. 29 | func (mg *Cluster) GetDeletionPolicy() xpv1.DeletionPolicy { 30 | return mg.Spec.DeletionPolicy 31 | } 32 | 33 | // GetManagementPolicies of this Cluster. 34 | func (mg *Cluster) GetManagementPolicies() xpv1.ManagementPolicies { 35 | return mg.Spec.ManagementPolicies 36 | } 37 | 38 | // GetProviderConfigReference of this Cluster. 39 | func (mg *Cluster) GetProviderConfigReference() *xpv1.Reference { 40 | return mg.Spec.ProviderConfigReference 41 | } 42 | 43 | // GetWriteConnectionSecretToReference of this Cluster. 44 | func (mg *Cluster) GetWriteConnectionSecretToReference() *xpv1.SecretReference { 45 | return mg.Spec.WriteConnectionSecretToReference 46 | } 47 | 48 | // SetConditions of this Cluster. 49 | func (mg *Cluster) SetConditions(c ...xpv1.Condition) { 50 | mg.Status.SetConditions(c...) 51 | } 52 | 53 | // SetDeletionPolicy of this Cluster. 54 | func (mg *Cluster) SetDeletionPolicy(r xpv1.DeletionPolicy) { 55 | mg.Spec.DeletionPolicy = r 56 | } 57 | 58 | // SetManagementPolicies of this Cluster. 59 | func (mg *Cluster) SetManagementPolicies(r xpv1.ManagementPolicies) { 60 | mg.Spec.ManagementPolicies = r 61 | } 62 | 63 | // SetProviderConfigReference of this Cluster. 64 | func (mg *Cluster) SetProviderConfigReference(r *xpv1.Reference) { 65 | mg.Spec.ProviderConfigReference = r 66 | } 67 | 68 | // SetWriteConnectionSecretToReference of this Cluster. 69 | func (mg *Cluster) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { 70 | mg.Spec.WriteConnectionSecretToReference = r 71 | } 72 | -------------------------------------------------------------------------------- /apis/cluster/cluster/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ClusterList. 24 | func (l *ClusterList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/cluster/projects/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=projects.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | -------------------------------------------------------------------------------- /apis/cluster/projects/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | "k8s.io/apimachinery/pkg/runtime/schema" 23 | "sigs.k8s.io/controller-runtime/pkg/scheme" 24 | ) 25 | 26 | // Package type metadata. 27 | const ( 28 | Group = "projects.argocd.crossplane.io" 29 | Version = "v1alpha1" 30 | ) 31 | 32 | var ( 33 | // SchemeGroupVersion is group version used to register these objects 34 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 35 | 36 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 37 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 38 | ) 39 | 40 | // Project type metadata 41 | var ( 42 | ProjectKind = reflect.TypeOf(Project{}).Name() 43 | ProjectGroupKind = schema.GroupKind{Group: Group, Kind: ProjectKind}.String() 44 | ProjectKindAPIVersion = ProjectKind + "." + SchemeGroupVersion.String() 45 | ProjectGroupVersionKind = SchemeGroupVersion.WithKind(ProjectKind) 46 | TokenKind = reflect.TypeOf(Token{}).Name() 47 | TokenGroupKind = schema.GroupKind{Group: Group, Kind: TokenKind}.String() 48 | TokenKindAPIVersion = TokenKind + "." + SchemeGroupVersion.String() 49 | TokenGroupVersionKind = SchemeGroupVersion.WithKind(TokenKind) 50 | ) 51 | 52 | func init() { 53 | SchemeBuilder.Register(&Project{}, &ProjectList{}) 54 | SchemeBuilder.Register(&Token{}, &TokenList{}) 55 | } 56 | -------------------------------------------------------------------------------- /apis/cluster/projects/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ProjectList. 24 | func (l *ProjectList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | 32 | // GetItems of this TokenList. 33 | func (l *TokenList) GetItems() []resource.Managed { 34 | items := make([]resource.Managed, len(l.Items)) 35 | for i := range l.Items { 36 | items[i] = &l.Items[i] 37 | } 38 | return items 39 | } 40 | -------------------------------------------------------------------------------- /apis/cluster/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package apis contains cluster-scoped Kubernetes API for argocd API. 18 | package cluster 19 | 20 | import ( 21 | "k8s.io/apimachinery/pkg/runtime" 22 | 23 | applicationv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/applications/v1alpha1" 24 | applicationsetsv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/applicationsets/v1alpha1" 25 | clusterv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/cluster/v1alpha1" 26 | projectsv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/projects/v1alpha1" 27 | repositoriesv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/repositories/v1alpha1" 28 | "github.com/crossplane-contrib/provider-argocd/apis/cluster/v1alpha1" 29 | ) 30 | 31 | func init() { 32 | // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back 33 | AddToSchemes = append(AddToSchemes, 34 | v1alpha1.SchemeBuilder.AddToScheme, 35 | repositoriesv1alpha1.SchemeBuilder.AddToScheme, 36 | projectsv1alpha1.SchemeBuilder.AddToScheme, 37 | clusterv1alpha1.SchemeBuilder.AddToScheme, 38 | applicationv1alpha1.SchemeBuilder.AddToScheme, 39 | applicationsetsv1alpha1.SchemeBuilder.AddToScheme, 40 | ) 41 | } 42 | 43 | // AddToSchemes may be used to add all resources defined in the project to a Scheme 44 | var AddToSchemes runtime.SchemeBuilder 45 | 46 | // AddToScheme adds all Resources to the Scheme 47 | func AddToScheme(s *runtime.Scheme) error { 48 | return AddToSchemes.AddToScheme(s) 49 | } 50 | -------------------------------------------------------------------------------- /apis/cluster/repositories/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=repositories.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | -------------------------------------------------------------------------------- /apis/cluster/repositories/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | "k8s.io/apimachinery/pkg/runtime/schema" 23 | "sigs.k8s.io/controller-runtime/pkg/scheme" 24 | ) 25 | 26 | // Package type metadata. 27 | const ( 28 | Group = "repositories.argocd.crossplane.io" 29 | Version = "v1alpha1" 30 | ) 31 | 32 | var ( 33 | // SchemeGroupVersion is group version used to register these objects 34 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 35 | 36 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 37 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 38 | ) 39 | 40 | // Repository type metadata 41 | var ( 42 | RepositoryKind = reflect.TypeOf(Repository{}).Name() 43 | RepositoryGroupKind = schema.GroupKind{Group: Group, Kind: RepositoryKind}.String() 44 | RepositoryKindAPIVersion = RepositoryKind + "." + SchemeGroupVersion.String() 45 | RepositoryGroupVersionKind = SchemeGroupVersion.WithKind(RepositoryKind) 46 | ) 47 | 48 | func init() { 49 | SchemeBuilder.Register(&Repository{}, &RepositoryList{}) 50 | } 51 | -------------------------------------------------------------------------------- /apis/cluster/repositories/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this Repository. 24 | func (mg *Repository) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetDeletionPolicy of this Repository. 29 | func (mg *Repository) GetDeletionPolicy() xpv1.DeletionPolicy { 30 | return mg.Spec.DeletionPolicy 31 | } 32 | 33 | // GetManagementPolicies of this Repository. 34 | func (mg *Repository) GetManagementPolicies() xpv1.ManagementPolicies { 35 | return mg.Spec.ManagementPolicies 36 | } 37 | 38 | // GetProviderConfigReference of this Repository. 39 | func (mg *Repository) GetProviderConfigReference() *xpv1.Reference { 40 | return mg.Spec.ProviderConfigReference 41 | } 42 | 43 | // GetWriteConnectionSecretToReference of this Repository. 44 | func (mg *Repository) GetWriteConnectionSecretToReference() *xpv1.SecretReference { 45 | return mg.Spec.WriteConnectionSecretToReference 46 | } 47 | 48 | // SetConditions of this Repository. 49 | func (mg *Repository) SetConditions(c ...xpv1.Condition) { 50 | mg.Status.SetConditions(c...) 51 | } 52 | 53 | // SetDeletionPolicy of this Repository. 54 | func (mg *Repository) SetDeletionPolicy(r xpv1.DeletionPolicy) { 55 | mg.Spec.DeletionPolicy = r 56 | } 57 | 58 | // SetManagementPolicies of this Repository. 59 | func (mg *Repository) SetManagementPolicies(r xpv1.ManagementPolicies) { 60 | mg.Spec.ManagementPolicies = r 61 | } 62 | 63 | // SetProviderConfigReference of this Repository. 64 | func (mg *Repository) SetProviderConfigReference(r *xpv1.Reference) { 65 | mg.Spec.ProviderConfigReference = r 66 | } 67 | 68 | // SetWriteConnectionSecretToReference of this Repository. 69 | func (mg *Repository) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { 70 | mg.Spec.WriteConnectionSecretToReference = r 71 | } 72 | -------------------------------------------------------------------------------- /apis/cluster/repositories/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this RepositoryList. 24 | func (l *RepositoryList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/cluster/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | -------------------------------------------------------------------------------- /apis/cluster/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | "k8s.io/apimachinery/pkg/runtime/schema" 23 | "sigs.k8s.io/controller-runtime/pkg/scheme" 24 | ) 25 | 26 | // Package type metadata. 27 | const ( 28 | Group = "argocd.crossplane.io" 29 | Version = "v1alpha1" 30 | ) 31 | 32 | var ( 33 | // SchemeGroupVersion is group version used to register these objects 34 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 35 | 36 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 37 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 38 | ) 39 | 40 | // Provider type metadata. 41 | var ( 42 | ProviderConfigKind = reflect.TypeOf(ProviderConfig{}).Name() 43 | ProviderConfigGroupKind = schema.GroupKind{Group: Group, Kind: ProviderConfigKind}.String() 44 | ProviderConfigKindAPIVersion = ProviderConfigKind + "." + SchemeGroupVersion.String() 45 | ProviderConfigGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigKind) 46 | ) 47 | 48 | // ProviderConfigUsage type metadata. 49 | var ( 50 | ProviderConfigUsageKind = reflect.TypeOf(ProviderConfigUsage{}).Name() 51 | ProviderConfigUsageGroupKind = schema.GroupKind{Group: Group, Kind: ProviderConfigUsageKind}.String() 52 | ProviderConfigUsageKindAPIVersion = ProviderConfigUsageKind + "." + SchemeGroupVersion.String() 53 | ProviderConfigUsageGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigUsageKind) 54 | 55 | ProviderConfigUsageListKind = reflect.TypeOf(ProviderConfigUsageList{}).Name() 56 | ProviderConfigUsageListGroupKind = schema.GroupKind{Group: Group, Kind: ProviderConfigUsageListKind}.String() 57 | ProviderConfigUsageListKindAPIVersion = ProviderConfigUsageListKind + "." + SchemeGroupVersion.String() 58 | ProviderConfigUsageListGroupVersionKind = SchemeGroupVersion.WithKind(ProviderConfigUsageListKind) 59 | ) 60 | 61 | func init() { 62 | SchemeBuilder.Register(&ProviderConfig{}, &ProviderConfigList{}) 63 | SchemeBuilder.Register(&ProviderConfigUsage{}, &ProviderConfigUsageList{}) 64 | } 65 | -------------------------------------------------------------------------------- /apis/cluster/v1alpha1/zz_generated.pc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this ProviderConfig. 24 | func (p *ProviderConfig) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return p.Status.GetCondition(ct) 26 | } 27 | 28 | // GetUsers of this ProviderConfig. 29 | func (p *ProviderConfig) GetUsers() int64 { 30 | return p.Status.Users 31 | } 32 | 33 | // SetConditions of this ProviderConfig. 34 | func (p *ProviderConfig) SetConditions(c ...xpv1.Condition) { 35 | p.Status.SetConditions(c...) 36 | } 37 | 38 | // SetUsers of this ProviderConfig. 39 | func (p *ProviderConfig) SetUsers(i int64) { 40 | p.Status.Users = i 41 | } 42 | -------------------------------------------------------------------------------- /apis/cluster/v1alpha1/zz_generated.pcu.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetProviderConfigReference of this ProviderConfigUsage. 24 | func (p *ProviderConfigUsage) GetProviderConfigReference() xpv1.Reference { 25 | return p.ProviderConfigReference 26 | } 27 | 28 | // GetResourceReference of this ProviderConfigUsage. 29 | func (p *ProviderConfigUsage) GetResourceReference() xpv1.TypedReference { 30 | return p.ResourceReference 31 | } 32 | 33 | // SetProviderConfigReference of this ProviderConfigUsage. 34 | func (p *ProviderConfigUsage) SetProviderConfigReference(r xpv1.Reference) { 35 | p.ProviderConfigReference = r 36 | } 37 | 38 | // SetResourceReference of this ProviderConfigUsage. 39 | func (p *ProviderConfigUsage) SetResourceReference(r xpv1.TypedReference) { 40 | p.ResourceReference = r 41 | } 42 | -------------------------------------------------------------------------------- /apis/cluster/v1alpha1/zz_generated.pculist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ProviderConfigUsageList. 24 | func (p *ProviderConfigUsageList) GetItems() []resource.ProviderConfigUsage { 25 | items := make([]resource.ProviderConfigUsage, len(p.Items)) 26 | for i := range p.Items { 27 | items[i] = &p.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/generate.go: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | 3 | /* 4 | Copyright 2021 The Crossplane Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | // NOTE(negz): See the below link for details on what is happening here. 20 | // https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module 21 | 22 | // Remove existing CRDs 23 | //go:generate rm -rf ../package/crds 24 | 25 | // Generate deepcopy methodsets and CRD manifests 26 | //go:generate go run -modfile ../tools/go.mod -tags generate sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile=../hack/boilerplate.go.txt paths=./... crd:allowDangerousTypes=true,crdVersions=v1 output:artifacts:config=../package/crds 27 | 28 | // Generate crossplane-runtime methodsets (resource.Managed, etc) 29 | //go:generate go run -modfile ../tools/go.mod -tags generate github.com/crossplane/crossplane-tools/cmd/angryjet generate-methodsets --header-file=../hack/boilerplate.go.txt ./... 30 | 31 | package apis 32 | -------------------------------------------------------------------------------- /apis/namespace/applications/v1alpha1/application_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | // Copy types from cluster-scope apis replace references with namespace types: 20 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copystruct ../../../cluster/applications/v1alpha1 zz_generated.types.copied.go ApplicationParameters,ArgoApplicationStatus 21 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.types.copied.go 22 | //go:generate sed -i s|v1\.Reference|v1.NamespacedReference|g zz_generated.types.copied.go 23 | //go:generate sed -i s|v1\.Selector|v1.NamespacedSelector|g zz_generated.types.copied.go 24 | 25 | import ( 26 | "reflect" 27 | 28 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 29 | xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" 30 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 31 | "k8s.io/apimachinery/pkg/runtime/schema" 32 | ) 33 | 34 | // A ApplicationSpec defines the desired state of an ArgoCD Application. 35 | type ApplicationSpec struct { 36 | xpv2.ManagedResourceSpec `json:",inline"` 37 | ForProvider ApplicationParameters `json:"forProvider"` 38 | } 39 | 40 | // A ApplicationStatus represents the observed state of an ArgoCD Application. 41 | type ApplicationStatus struct { 42 | xpv1.ResourceStatus `json:",inline"` 43 | AtProvider ArgoApplicationStatus `json:"atProvider,omitempty"` 44 | } 45 | 46 | // +kubebuilder:object:root=true 47 | 48 | // An Application is a managed resource that represents an ArgoCD Application 49 | // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" 50 | // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" 51 | // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" 52 | // +kubebuilder:subresource:status 53 | // +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,argocd} 54 | type Application struct { 55 | metav1.TypeMeta `json:",inline"` 56 | metav1.ObjectMeta `json:"metadata,omitempty"` 57 | 58 | Spec ApplicationSpec `json:"spec"` 59 | Status ApplicationStatus `json:"status,omitempty"` 60 | } 61 | 62 | // +kubebuilder:object:root=true 63 | 64 | // ApplicationList contains a list of Application items 65 | type ApplicationList struct { 66 | metav1.TypeMeta `json:",inline"` 67 | metav1.ListMeta `json:"metadata,omitempty"` 68 | Items []Application `json:"items"` 69 | } 70 | 71 | // Application type metadata 72 | var ( 73 | ApplicationKind = reflect.TypeOf(Application{}).Name() 74 | ApplicationGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationKind}.String() 75 | ApplicationKindAPIVersion = ApplicationKind + "." + SchemeGroupVersion.String() 76 | ApplicationGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationKind) 77 | ) 78 | 79 | func init() { 80 | SchemeBuilder.Register(&Application{}, &ApplicationList{}) 81 | } 82 | -------------------------------------------------------------------------------- /apis/namespace/applications/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=applications.m.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | 23 | import ( 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | "sigs.k8s.io/controller-runtime/pkg/scheme" 26 | ) 27 | 28 | // Package type metadata. 29 | const ( 30 | Group = "applications.m.argocd.crossplane.io" 31 | Version = "v1alpha1" 32 | ) 33 | 34 | var ( 35 | // SchemeGroupVersion is group version used to register these objects 36 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 37 | 38 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 39 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 40 | ) 41 | -------------------------------------------------------------------------------- /apis/namespace/applications/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this Application. 24 | func (mg *Application) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetManagementPolicies of this Application. 29 | func (mg *Application) GetManagementPolicies() xpv1.ManagementPolicies { 30 | return mg.Spec.ManagementPolicies 31 | } 32 | 33 | // GetProviderConfigReference of this Application. 34 | func (mg *Application) GetProviderConfigReference() *xpv1.ProviderConfigReference { 35 | return mg.Spec.ProviderConfigReference 36 | } 37 | 38 | // GetWriteConnectionSecretToReference of this Application. 39 | func (mg *Application) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { 40 | return mg.Spec.WriteConnectionSecretToReference 41 | } 42 | 43 | // SetConditions of this Application. 44 | func (mg *Application) SetConditions(c ...xpv1.Condition) { 45 | mg.Status.SetConditions(c...) 46 | } 47 | 48 | // SetManagementPolicies of this Application. 49 | func (mg *Application) SetManagementPolicies(r xpv1.ManagementPolicies) { 50 | mg.Spec.ManagementPolicies = r 51 | } 52 | 53 | // SetProviderConfigReference of this Application. 54 | func (mg *Application) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { 55 | mg.Spec.ProviderConfigReference = r 56 | } 57 | 58 | // SetWriteConnectionSecretToReference of this Application. 59 | func (mg *Application) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { 60 | mg.Spec.WriteConnectionSecretToReference = r 61 | } 62 | -------------------------------------------------------------------------------- /apis/namespace/applications/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ApplicationList. 24 | func (l *ApplicationList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/namespace/applicationsets/v1alpha1/applicationset_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | // Copy types from cluster-scope apis replace references with namespace types: 20 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copystruct ../../../cluster/applicationsets/v1alpha1 zz_generated.types.copied.go ApplicationSetParameters,ArgoApplicationSetStatus 21 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.types.copied.go 22 | //go:generate sed -i s|commonv1\.Reference|commonv1.NamespacedReference|g zz_generated.types.copied.go 23 | //go:generate sed -i s|commonv1\.Selector|commonv1.NamespacedSelector|g zz_generated.types.copied.go 24 | 25 | import ( 26 | "reflect" 27 | 28 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 29 | xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" 30 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 31 | "k8s.io/apimachinery/pkg/runtime/schema" 32 | ) 33 | 34 | // A ApplicationSetSpec defines the desired state of a ApplicationSet. 35 | type ApplicationSetSpec struct { 36 | xpv2.ManagedResourceSpec `json:",inline"` 37 | ForProvider ApplicationSetParameters `json:"forProvider"` 38 | } 39 | 40 | // A ApplicationSetStatus represents the observed state of a ApplicationSet. 41 | type ApplicationSetStatus struct { 42 | xpv1.ResourceStatus `json:",inline"` 43 | AtProvider ArgoApplicationSetStatus `json:"atProvider,omitempty"` 44 | } 45 | 46 | // +kubebuilder:object:root=true 47 | 48 | // A ApplicationSet is an example API type. 49 | // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" 50 | // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" 51 | // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" 52 | // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" 53 | // +kubebuilder:subresource:status 54 | // +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,argocd} 55 | type ApplicationSet struct { 56 | metav1.TypeMeta `json:",inline"` 57 | metav1.ObjectMeta `json:"metadata,omitempty"` 58 | 59 | Spec ApplicationSetSpec `json:"spec"` 60 | Status ApplicationSetStatus `json:"status,omitempty"` 61 | } 62 | 63 | // +kubebuilder:object:root=true 64 | 65 | // ApplicationSetList contains a list of ApplicationSet 66 | type ApplicationSetList struct { 67 | metav1.TypeMeta `json:",inline"` 68 | metav1.ListMeta `json:"metadata,omitempty"` 69 | Items []ApplicationSet `json:"items"` 70 | } 71 | 72 | // ApplicationSet type metadata. 73 | var ( 74 | ApplicationSetKind = reflect.TypeOf(ApplicationSet{}).Name() 75 | ApplicationSetGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationSetKind}.String() 76 | ApplicationSetKindAPIVersion = ApplicationSetKind + "." + SchemeGroupVersion.String() 77 | ApplicationSetGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationSetKind) 78 | ) 79 | 80 | func init() { 81 | SchemeBuilder.Register(&ApplicationSet{}, &ApplicationSetList{}) 82 | } 83 | -------------------------------------------------------------------------------- /apis/namespace/applicationsets/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=applicationsets.m.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | 23 | import ( 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | "sigs.k8s.io/controller-runtime/pkg/scheme" 26 | ) 27 | 28 | // Package type metadata. 29 | const ( 30 | Group = "applicationsets.m.argocd.crossplane.io" 31 | Version = "v1alpha1" 32 | ) 33 | 34 | var ( 35 | // SchemeGroupVersion is group version used to register these objects 36 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 37 | 38 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 39 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 40 | ) 41 | -------------------------------------------------------------------------------- /apis/namespace/applicationsets/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this ApplicationSet. 24 | func (mg *ApplicationSet) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetManagementPolicies of this ApplicationSet. 29 | func (mg *ApplicationSet) GetManagementPolicies() xpv1.ManagementPolicies { 30 | return mg.Spec.ManagementPolicies 31 | } 32 | 33 | // GetProviderConfigReference of this ApplicationSet. 34 | func (mg *ApplicationSet) GetProviderConfigReference() *xpv1.ProviderConfigReference { 35 | return mg.Spec.ProviderConfigReference 36 | } 37 | 38 | // GetWriteConnectionSecretToReference of this ApplicationSet. 39 | func (mg *ApplicationSet) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { 40 | return mg.Spec.WriteConnectionSecretToReference 41 | } 42 | 43 | // SetConditions of this ApplicationSet. 44 | func (mg *ApplicationSet) SetConditions(c ...xpv1.Condition) { 45 | mg.Status.SetConditions(c...) 46 | } 47 | 48 | // SetManagementPolicies of this ApplicationSet. 49 | func (mg *ApplicationSet) SetManagementPolicies(r xpv1.ManagementPolicies) { 50 | mg.Spec.ManagementPolicies = r 51 | } 52 | 53 | // SetProviderConfigReference of this ApplicationSet. 54 | func (mg *ApplicationSet) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { 55 | mg.Spec.ProviderConfigReference = r 56 | } 57 | 58 | // SetWriteConnectionSecretToReference of this ApplicationSet. 59 | func (mg *ApplicationSet) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { 60 | mg.Spec.WriteConnectionSecretToReference = r 61 | } 62 | -------------------------------------------------------------------------------- /apis/namespace/applicationsets/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ApplicationSetList. 24 | func (l *ApplicationSetList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/namespace/cluster/v1alpha1/cluster_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 23 | xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" 24 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | "k8s.io/apimachinery/pkg/runtime/schema" 26 | ) 27 | 28 | // Copy types from cluster-scope apis replace references with namespace types: 29 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copystruct ../../../cluster/cluster/v1alpha1 zz_generated.types.copied.go ClusterParameters,ClusterObservation 30 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.types.copied.go 31 | //go:generate sed -i s|commonv1\.Reference|commonv1.NamespacedReference|g zz_generated.types.copied.go 32 | //go:generate sed -i s|commonv1\.Selector|commonv1.NamespacedSelector|g zz_generated.types.copied.go 33 | 34 | // A ClusterSpec defines the desired state of an ArgoCD Cluster. 35 | type ClusterSpec struct { 36 | xpv2.ManagedResourceSpec `json:",inline"` 37 | ForProvider ClusterParameters `json:"forProvider"` 38 | } 39 | 40 | // A ClusterStatus represents the observed state of an ArgoCD Cluster. 41 | type ClusterStatus struct { 42 | xpv1.ResourceStatus `json:",inline"` 43 | AtProvider ClusterObservation `json:"atProvider,omitempty"` 44 | } 45 | 46 | // +kubebuilder:object:root=true 47 | 48 | // A Cluster is a managed resource that represents an ArgoCD Git Cluster 49 | // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" 50 | // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" 51 | // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" 52 | // +kubebuilder:subresource:status 53 | // +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,argocd} 54 | type Cluster struct { 55 | metav1.TypeMeta `json:",inline"` 56 | metav1.ObjectMeta `json:"metadata,omitempty"` 57 | 58 | Spec ClusterSpec `json:"spec"` 59 | Status ClusterStatus `json:"status,omitempty"` 60 | } 61 | 62 | // +kubebuilder:object:root=true 63 | 64 | // ClusterList contains a list of Cluster items 65 | type ClusterList struct { 66 | metav1.TypeMeta `json:",inline"` 67 | metav1.ListMeta `json:"metadata,omitempty"` 68 | Items []Cluster `json:"items"` 69 | } 70 | 71 | // Cluster type metadata 72 | var ( 73 | ClusterKind = reflect.TypeOf(Cluster{}).Name() 74 | ClusterGroupKind = schema.GroupKind{Group: Group, Kind: ClusterKind}.String() 75 | ClusterKindAPIVersion = ClusterKind + "." + SchemeGroupVersion.String() 76 | ClusterGroupVersionKind = SchemeGroupVersion.WithKind(ClusterKind) 77 | ) 78 | 79 | func init() { 80 | SchemeBuilder.Register(&Cluster{}, &ClusterList{}) 81 | } 82 | -------------------------------------------------------------------------------- /apis/namespace/cluster/v1alpha1/referencers.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "github.com/crossplane/crossplane-runtime/v2/pkg/reference" 5 | "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 6 | ) 7 | 8 | // ServerName returns the Spec.ForProvider.Name of an Cluster. 9 | func ServerName() reference.ExtractValueFn { 10 | return func(mg resource.Managed) string { 11 | r, ok := mg.(*Cluster) 12 | if !ok { 13 | return "" 14 | } 15 | if r.Spec.ForProvider.Name == nil { 16 | return "" 17 | } 18 | return *r.Spec.ForProvider.Name 19 | } 20 | } 21 | 22 | // ServerAddress returns the Spec.ForProvider.Server of a Cluster 23 | func ServerAddress() reference.ExtractValueFn { 24 | return func(mg resource.Managed) string { 25 | r, ok := mg.(*Cluster) 26 | if !ok { 27 | return "" 28 | } 29 | if r.Spec.ForProvider.Server == nil { 30 | return "" 31 | } 32 | return *r.Spec.ForProvider.Server 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /apis/namespace/cluster/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=cluster.m.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | 23 | import ( 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | "sigs.k8s.io/controller-runtime/pkg/scheme" 26 | ) 27 | 28 | // Package type metadata. 29 | const ( 30 | Group = "cluster.m.argocd.crossplane.io" 31 | Version = "v1alpha1" 32 | ) 33 | 34 | var ( 35 | // SchemeGroupVersion is group version used to register these objects 36 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 37 | 38 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 39 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 40 | ) 41 | -------------------------------------------------------------------------------- /apis/namespace/cluster/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this Cluster. 24 | func (mg *Cluster) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetManagementPolicies of this Cluster. 29 | func (mg *Cluster) GetManagementPolicies() xpv1.ManagementPolicies { 30 | return mg.Spec.ManagementPolicies 31 | } 32 | 33 | // GetProviderConfigReference of this Cluster. 34 | func (mg *Cluster) GetProviderConfigReference() *xpv1.ProviderConfigReference { 35 | return mg.Spec.ProviderConfigReference 36 | } 37 | 38 | // GetWriteConnectionSecretToReference of this Cluster. 39 | func (mg *Cluster) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { 40 | return mg.Spec.WriteConnectionSecretToReference 41 | } 42 | 43 | // SetConditions of this Cluster. 44 | func (mg *Cluster) SetConditions(c ...xpv1.Condition) { 45 | mg.Status.SetConditions(c...) 46 | } 47 | 48 | // SetManagementPolicies of this Cluster. 49 | func (mg *Cluster) SetManagementPolicies(r xpv1.ManagementPolicies) { 50 | mg.Spec.ManagementPolicies = r 51 | } 52 | 53 | // SetProviderConfigReference of this Cluster. 54 | func (mg *Cluster) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { 55 | mg.Spec.ProviderConfigReference = r 56 | } 57 | 58 | // SetWriteConnectionSecretToReference of this Cluster. 59 | func (mg *Cluster) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { 60 | mg.Spec.WriteConnectionSecretToReference = r 61 | } 62 | -------------------------------------------------------------------------------- /apis/namespace/cluster/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ClusterList. 24 | func (l *ClusterList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/namespace/projects/v1alpha1/project_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 23 | xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" 24 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | "k8s.io/apimachinery/pkg/runtime/schema" 26 | ) 27 | 28 | // Copy types from cluster-scope apis replace references with namespace types: 29 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copystruct ../../../cluster/projects/v1alpha1 zz_generated.project_types.copied.go ProjectParameters,ProjectObservation 30 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.project_types.copied.go 31 | //go:generate sed -i s|v1\.Reference|v1.NamespacedReference|g zz_generated.project_types.copied.go 32 | //go:generate sed -i s|v1\.Selector|v1.NamespacedSelector|g zz_generated.project_types.copied.go 33 | 34 | // A ProjectSpec defines the desired state of an ArgoCD Project. 35 | type ProjectSpec struct { 36 | xpv2.ManagedResourceSpec `json:",inline"` 37 | ForProvider ProjectParameters `json:"forProvider"` 38 | } 39 | 40 | // A ProjectStatus represents the observed state of an ArgoCD Project. 41 | type ProjectStatus struct { 42 | xpv1.ResourceStatus `json:",inline"` 43 | AtProvider ProjectObservation `json:"atProvider,omitempty"` 44 | } 45 | 46 | // +kubebuilder:object:root=true 47 | 48 | // A Project is a managed resource that represents an ArgoCD Git Project 49 | // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" 50 | // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" 51 | // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" 52 | // +kubebuilder:subresource:status 53 | // +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,argocd} 54 | type Project struct { 55 | metav1.TypeMeta `json:",inline"` 56 | metav1.ObjectMeta `json:"metadata,omitempty"` 57 | 58 | Spec ProjectSpec `json:"spec"` 59 | Status ProjectStatus `json:"status,omitempty"` 60 | } 61 | 62 | // +kubebuilder:object:root=true 63 | 64 | // ProjectList contains a list of Project items 65 | type ProjectList struct { 66 | metav1.TypeMeta `json:",inline"` 67 | metav1.ListMeta `json:"metadata,omitempty"` 68 | Items []Project `json:"items"` 69 | } 70 | 71 | // Project type metadata 72 | var ( 73 | ProjectKind = reflect.TypeOf(Project{}).Name() 74 | ProjectGroupKind = schema.GroupKind{Group: Group, Kind: ProjectKind}.String() 75 | ProjectKindAPIVersion = ProjectKind + "." + SchemeGroupVersion.String() 76 | ProjectGroupVersionKind = SchemeGroupVersion.WithKind(ProjectKind) 77 | ) 78 | 79 | func init() { 80 | SchemeBuilder.Register(&Project{}, &ProjectList{}) 81 | } 82 | -------------------------------------------------------------------------------- /apis/namespace/projects/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=projects.m.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | 23 | import ( 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | "sigs.k8s.io/controller-runtime/pkg/scheme" 26 | ) 27 | 28 | // Package type metadata. 29 | const ( 30 | Group = "projects.m.argocd.crossplane.io" 31 | Version = "v1alpha1" 32 | ) 33 | 34 | var ( 35 | // SchemeGroupVersion is group version used to register these objects 36 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 37 | 38 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 39 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 40 | ) 41 | -------------------------------------------------------------------------------- /apis/namespace/projects/v1alpha1/token_types.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "reflect" 5 | 6 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 7 | xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" 8 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 | "k8s.io/apimachinery/pkg/runtime/schema" 10 | ) 11 | 12 | // Copy types from cluster-scope apis replace references with namespace types: 13 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copystruct ../../../cluster/projects/v1alpha1 zz_generated.token_types.copied.go TokenParameters,TokenObservation 14 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.token_types.copied.go 15 | //go:generate sed -i s|v1\.Reference|v1.NamespacedReference|g zz_generated.token_types.copied.go 16 | //go:generate sed -i s|v1\.Selector|v1.NamespacedSelector|g zz_generated.token_types.copied.go 17 | 18 | // A TokenSpec defines the desired state of an ArgoCD Token. 19 | type TokenSpec struct { 20 | xpv2.ManagedResourceSpec `json:",inline"` 21 | ForProvider TokenParameters `json:"forProvider"` 22 | } 23 | 24 | // A TokenStatus represents the observed state of an ArgoCD Project Token. 25 | type TokenStatus struct { 26 | xpv1.ResourceStatus `json:",inline"` 27 | AtProvider TokenObservation `json:"atProvider,omitempty"` 28 | } 29 | 30 | // +kubebuilder:object:root=true 31 | 32 | // A Token is a managed resource that represents an ArgoCD Project Token 33 | // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" 34 | // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" 35 | // +kubebuilder:printcolumn:name="PROJECT",type="string",JSONPath=".spec.forProvider.project" 36 | // +kubebuilder:printcolumn:name="ROLE",type="string",JSONPath=".spec.forProvider.role" 37 | // +kubebuilder:printcolumn:name="EXPIRES-AT",type="string",JSONPath=".status.atProvider.exp" 38 | // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" 39 | // +kubebuilder:subresource:status 40 | // +kubebuilder:resource:scope=Namespaced,categories={crossplane,managed,argocd} 41 | type Token struct { 42 | metav1.TypeMeta `json:",inline"` 43 | metav1.ObjectMeta `json:"metadata,omitempty"` 44 | 45 | Spec TokenSpec `json:"spec"` 46 | Status TokenStatus `json:"status,omitempty"` 47 | } 48 | 49 | // +kubebuilder:object:root=true 50 | 51 | // TokenList contains a list of Token items 52 | type TokenList struct { 53 | metav1.TypeMeta `json:",inline"` 54 | metav1.ListMeta `json:"metadata,omitempty"` 55 | Items []Token `json:"items"` 56 | } 57 | 58 | // Token type metadata 59 | var ( 60 | TokenKind = reflect.TypeOf(Token{}).Name() 61 | TokenGroupKind = schema.GroupKind{Group: Group, Kind: TokenKind}.String() 62 | TokenKindAPIVersion = TokenKind + "." + SchemeGroupVersion.String() 63 | TokenGroupVersionKind = SchemeGroupVersion.WithKind(TokenKind) 64 | ) 65 | 66 | func init() { 67 | SchemeBuilder.Register(&Token{}, &TokenList{}) 68 | } 69 | -------------------------------------------------------------------------------- /apis/namespace/projects/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this Project. 24 | func (mg *Project) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetManagementPolicies of this Project. 29 | func (mg *Project) GetManagementPolicies() xpv1.ManagementPolicies { 30 | return mg.Spec.ManagementPolicies 31 | } 32 | 33 | // GetProviderConfigReference of this Project. 34 | func (mg *Project) GetProviderConfigReference() *xpv1.ProviderConfigReference { 35 | return mg.Spec.ProviderConfigReference 36 | } 37 | 38 | // GetWriteConnectionSecretToReference of this Project. 39 | func (mg *Project) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { 40 | return mg.Spec.WriteConnectionSecretToReference 41 | } 42 | 43 | // SetConditions of this Project. 44 | func (mg *Project) SetConditions(c ...xpv1.Condition) { 45 | mg.Status.SetConditions(c...) 46 | } 47 | 48 | // SetManagementPolicies of this Project. 49 | func (mg *Project) SetManagementPolicies(r xpv1.ManagementPolicies) { 50 | mg.Spec.ManagementPolicies = r 51 | } 52 | 53 | // SetProviderConfigReference of this Project. 54 | func (mg *Project) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { 55 | mg.Spec.ProviderConfigReference = r 56 | } 57 | 58 | // SetWriteConnectionSecretToReference of this Project. 59 | func (mg *Project) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { 60 | mg.Spec.WriteConnectionSecretToReference = r 61 | } 62 | 63 | // GetCondition of this Token. 64 | func (mg *Token) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 65 | return mg.Status.GetCondition(ct) 66 | } 67 | 68 | // GetManagementPolicies of this Token. 69 | func (mg *Token) GetManagementPolicies() xpv1.ManagementPolicies { 70 | return mg.Spec.ManagementPolicies 71 | } 72 | 73 | // GetProviderConfigReference of this Token. 74 | func (mg *Token) GetProviderConfigReference() *xpv1.ProviderConfigReference { 75 | return mg.Spec.ProviderConfigReference 76 | } 77 | 78 | // GetWriteConnectionSecretToReference of this Token. 79 | func (mg *Token) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { 80 | return mg.Spec.WriteConnectionSecretToReference 81 | } 82 | 83 | // SetConditions of this Token. 84 | func (mg *Token) SetConditions(c ...xpv1.Condition) { 85 | mg.Status.SetConditions(c...) 86 | } 87 | 88 | // SetManagementPolicies of this Token. 89 | func (mg *Token) SetManagementPolicies(r xpv1.ManagementPolicies) { 90 | mg.Spec.ManagementPolicies = r 91 | } 92 | 93 | // SetProviderConfigReference of this Token. 94 | func (mg *Token) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { 95 | mg.Spec.ProviderConfigReference = r 96 | } 97 | 98 | // SetWriteConnectionSecretToReference of this Token. 99 | func (mg *Token) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { 100 | mg.Spec.WriteConnectionSecretToReference = r 101 | } 102 | -------------------------------------------------------------------------------- /apis/namespace/projects/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ProjectList. 24 | func (l *ProjectList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | 32 | // GetItems of this TokenList. 33 | func (l *TokenList) GetItems() []resource.Managed { 34 | items := make([]resource.Managed, len(l.Items)) 35 | for i := range l.Items { 36 | items[i] = &l.Items[i] 37 | } 38 | return items 39 | } 40 | -------------------------------------------------------------------------------- /apis/namespace/projects/v1alpha1/zz_generated.token_types.copied.go: -------------------------------------------------------------------------------- 1 | // Code generated by copystruct. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 7 | ) 8 | 9 | // TokenParameters define the desired state of an ArgoCD Project Token 10 | type TokenParameters struct { 11 | // Project is the project associated with the token 12 | // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-argocd/apis/namespace/projects/v1alpha1.Project 13 | // +crossplane:generate:reference:refFieldName=ProjectRef 14 | // +crossplane:generate:reference:selectorFieldName=ProjectSelector 15 | Project *string `json:"project"` 16 | 17 | // ProjectRefs is a reference to a Project used to set Project 18 | // +optional 19 | ProjectRef *v1.NamespacedReference `json:"projectRef,omitempty"` 20 | 21 | // ProjectSelector selects reference to a Project used to ProjectRef 22 | // +optional 23 | ProjectSelector *v1.NamespacedSelector `json:"projectSelector,omitempty"` 24 | 25 | // Role is the role associated with the token. 26 | Role string `json:"role"` 27 | 28 | // ID is an id for the token 29 | // +optional 30 | ID string `json:"id"` 31 | 32 | // Description is a description for the token 33 | // +optional 34 | Description *string `json:"description,omitempty"` 35 | 36 | // Duration before the token will expire. Valid time units are `s`, `m`, `h` and `d` E.g. 12h, 7d. No expiration if not set. 37 | // +optional 38 | // +kubebuilder:validation:Pattern=`^(0|[0-9]+(s|m|h|d))$` 39 | ExpiresIn *string `json:"expiresIn,omitempty"` 40 | 41 | // Duration to control token regeneration based on token age. Valid time units are `s`, `m`, `h` and `d`. 42 | // +optional 43 | // +kubebuilder:validation:Pattern=`^([0-9]+)(s|m|h|d)$` 44 | RenewAfter *string `json:"renewAfter,omitempty"` 45 | 46 | // Duration to control token regeneration based on remaining token lifetime. Valid time units are `s`, `m`, `h` and `d`. 47 | // +optional 48 | // +kubebuilder:validation:Pattern=`^([0-9]+)(s|m|h|d)$` 49 | RenewBefore *string `json:"renewBefore,omitempty"` 50 | } 51 | 52 | // TokenObservation holds the issuedAt and expiresAt values of a token 53 | type TokenObservation struct { 54 | IssuedAt int64 `json:"iat"` 55 | // +optional 56 | ExpiresAt *int64 `json:"exp,omitempty"` 57 | // +optional 58 | ID *string `json:"id,omitempty"` 59 | } 60 | -------------------------------------------------------------------------------- /apis/namespace/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package apis contains cluster-scoped Kubernetes API for argocd API. 18 | package cluster 19 | 20 | import ( 21 | "k8s.io/apimachinery/pkg/runtime" 22 | 23 | applicationv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/applications/v1alpha1" 24 | applicationsetsv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/applicationsets/v1alpha1" 25 | clusterv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/cluster/v1alpha1" 26 | projectsv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/projects/v1alpha1" 27 | repositoriesv1alpha1 "github.com/crossplane-contrib/provider-argocd/apis/cluster/repositories/v1alpha1" 28 | "github.com/crossplane-contrib/provider-argocd/apis/cluster/v1alpha1" 29 | ) 30 | 31 | func init() { 32 | // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back 33 | AddToSchemes = append(AddToSchemes, 34 | v1alpha1.SchemeBuilder.AddToScheme, 35 | repositoriesv1alpha1.SchemeBuilder.AddToScheme, 36 | projectsv1alpha1.SchemeBuilder.AddToScheme, 37 | clusterv1alpha1.SchemeBuilder.AddToScheme, 38 | applicationv1alpha1.SchemeBuilder.AddToScheme, 39 | applicationsetsv1alpha1.SchemeBuilder.AddToScheme, 40 | ) 41 | } 42 | 43 | // AddToSchemes may be used to add all resources defined in the project to a Scheme 44 | var AddToSchemes runtime.SchemeBuilder 45 | 46 | // AddToScheme adds all Resources to the Scheme 47 | func AddToScheme(s *runtime.Scheme) error { 48 | return AddToSchemes.AddToScheme(s) 49 | } 50 | -------------------------------------------------------------------------------- /apis/namespace/repositories/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=repositories.m.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | 23 | import ( 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | "sigs.k8s.io/controller-runtime/pkg/scheme" 26 | ) 27 | 28 | // Package type metadata. 29 | const ( 30 | Group = "repositories.m.argocd.crossplane.io" 31 | Version = "v1alpha1" 32 | ) 33 | 34 | var ( 35 | // SchemeGroupVersion is group version used to register these objects 36 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 37 | 38 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 39 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 40 | ) 41 | -------------------------------------------------------------------------------- /apis/namespace/repositories/v1alpha1/repository_types.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha1 18 | 19 | import ( 20 | "reflect" 21 | 22 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 23 | xpv2 "github.com/crossplane/crossplane-runtime/v2/apis/common/v2" 24 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 | "k8s.io/apimachinery/pkg/runtime/schema" 26 | ) 27 | 28 | // Copy types from cluster-scope apis replace references with namespace types: 29 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copystruct ../../../cluster/repositories/v1alpha1 zz_generated.repository_types.copied.go RepositoryParameters,RepositoryObservation 30 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.repository_types.copied.go 31 | //go:generate sed -i s|v1\.Reference|v1.NamespacedReference|g zz_generated.repository_types.copied.go 32 | //go:generate sed -i s|v1\.Selector|v1.NamespacedSelector|g zz_generated.repository_types.copied.go 33 | 34 | // A RepositorySpec defines the desired state of an ArgoCD Repository. 35 | type RepositorySpec struct { 36 | xpv2.ManagedResourceSpec `json:",inline"` 37 | ForProvider RepositoryParameters `json:"forProvider"` 38 | } 39 | 40 | // A RepositoryStatus represents the observed state of an ArgoCD Repository. 41 | type RepositoryStatus struct { 42 | xpv1.ResourceStatus `json:",inline"` 43 | AtProvider RepositoryObservation `json:"atProvider,omitempty"` 44 | } 45 | 46 | // +kubebuilder:object:root=true 47 | 48 | // A Repository is a managed resource that represents an ArgoCD Git Repository 49 | // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" 50 | // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" 51 | // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" 52 | // +kubebuilder:subresource:status 53 | // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,argocd} 54 | type Repository struct { 55 | metav1.TypeMeta `json:",inline"` 56 | metav1.ObjectMeta `json:"metadata,omitempty"` 57 | 58 | Spec RepositorySpec `json:"spec"` 59 | Status RepositoryStatus `json:"status,omitempty"` 60 | } 61 | 62 | // +kubebuilder:object:root=true 63 | 64 | // RepositoryList contains a list of Repository items 65 | type RepositoryList struct { 66 | metav1.TypeMeta `json:",inline"` 67 | metav1.ListMeta `json:"metadata,omitempty"` 68 | Items []Repository `json:"items"` 69 | } 70 | 71 | // Repository type metadata 72 | var ( 73 | RepositoryKind = reflect.TypeOf(Repository{}).Name() 74 | RepositoryGroupKind = schema.GroupKind{Group: Group, Kind: RepositoryKind}.String() 75 | RepositoryKindAPIVersion = RepositoryKind + "." + SchemeGroupVersion.String() 76 | RepositoryGroupVersionKind = SchemeGroupVersion.WithKind(RepositoryKind) 77 | ) 78 | 79 | func init() { 80 | SchemeBuilder.Register(&Repository{}, &RepositoryList{}) 81 | } 82 | -------------------------------------------------------------------------------- /apis/namespace/repositories/v1alpha1/zz_generated.managed.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this Repository. 24 | func (mg *Repository) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return mg.Status.GetCondition(ct) 26 | } 27 | 28 | // GetManagementPolicies of this Repository. 29 | func (mg *Repository) GetManagementPolicies() xpv1.ManagementPolicies { 30 | return mg.Spec.ManagementPolicies 31 | } 32 | 33 | // GetProviderConfigReference of this Repository. 34 | func (mg *Repository) GetProviderConfigReference() *xpv1.ProviderConfigReference { 35 | return mg.Spec.ProviderConfigReference 36 | } 37 | 38 | // GetWriteConnectionSecretToReference of this Repository. 39 | func (mg *Repository) GetWriteConnectionSecretToReference() *xpv1.LocalSecretReference { 40 | return mg.Spec.WriteConnectionSecretToReference 41 | } 42 | 43 | // SetConditions of this Repository. 44 | func (mg *Repository) SetConditions(c ...xpv1.Condition) { 45 | mg.Status.SetConditions(c...) 46 | } 47 | 48 | // SetManagementPolicies of this Repository. 49 | func (mg *Repository) SetManagementPolicies(r xpv1.ManagementPolicies) { 50 | mg.Spec.ManagementPolicies = r 51 | } 52 | 53 | // SetProviderConfigReference of this Repository. 54 | func (mg *Repository) SetProviderConfigReference(r *xpv1.ProviderConfigReference) { 55 | mg.Spec.ProviderConfigReference = r 56 | } 57 | 58 | // SetWriteConnectionSecretToReference of this Repository. 59 | func (mg *Repository) SetWriteConnectionSecretToReference(r *xpv1.LocalSecretReference) { 60 | mg.Spec.WriteConnectionSecretToReference = r 61 | } 62 | -------------------------------------------------------------------------------- /apis/namespace/repositories/v1alpha1/zz_generated.managedlist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this RepositoryList. 24 | func (l *RepositoryList) GetItems() []resource.Managed { 25 | items := make([]resource.Managed, len(l.Items)) 26 | for i := range l.Items { 27 | items[i] = &l.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/namespace/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the core resources of the argocd provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName=m.argocd.crossplane.io 20 | // +versionName=v1alpha1 21 | package v1alpha1 22 | 23 | import ( 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | "sigs.k8s.io/controller-runtime/pkg/scheme" 26 | ) 27 | 28 | // Package type metadata. 29 | const ( 30 | Group = "m.argocd.crossplane.io" 31 | Version = "v1alpha1" 32 | ) 33 | 34 | var ( 35 | // SchemeGroupVersion is group version used to register these objects 36 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 37 | 38 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 39 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 40 | ) 41 | -------------------------------------------------------------------------------- /apis/namespace/v1alpha1/zz_generated.pc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetCondition of this ProviderConfig. 24 | func (p *ProviderConfig) GetCondition(ct xpv1.ConditionType) xpv1.Condition { 25 | return p.Status.GetCondition(ct) 26 | } 27 | 28 | // GetUsers of this ProviderConfig. 29 | func (p *ProviderConfig) GetUsers() int64 { 30 | return p.Status.Users 31 | } 32 | 33 | // SetConditions of this ProviderConfig. 34 | func (p *ProviderConfig) SetConditions(c ...xpv1.Condition) { 35 | p.Status.SetConditions(c...) 36 | } 37 | 38 | // SetUsers of this ProviderConfig. 39 | func (p *ProviderConfig) SetUsers(i int64) { 40 | p.Status.Users = i 41 | } 42 | -------------------------------------------------------------------------------- /apis/namespace/v1alpha1/zz_generated.pcu.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 22 | 23 | // GetProviderConfigReference of this ProviderConfigUsage. 24 | func (p *ProviderConfigUsage) GetProviderConfigReference() xpv1.ProviderConfigReference { 25 | return p.ProviderConfigReference 26 | } 27 | 28 | // GetResourceReference of this ProviderConfigUsage. 29 | func (p *ProviderConfigUsage) GetResourceReference() xpv1.TypedReference { 30 | return p.ResourceReference 31 | } 32 | 33 | // SetProviderConfigReference of this ProviderConfigUsage. 34 | func (p *ProviderConfigUsage) SetProviderConfigReference(r xpv1.ProviderConfigReference) { 35 | p.ProviderConfigReference = r 36 | } 37 | 38 | // SetResourceReference of this ProviderConfigUsage. 39 | func (p *ProviderConfigUsage) SetResourceReference(r xpv1.TypedReference) { 40 | p.ResourceReference = r 41 | } 42 | -------------------------------------------------------------------------------- /apis/namespace/v1alpha1/zz_generated.pculist.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Code generated by angryjet. DO NOT EDIT. 18 | 19 | package v1alpha1 20 | 21 | import resource "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 22 | 23 | // GetItems of this ProviderConfigUsageList. 24 | func (p *ProviderConfigUsageList) GetItems() []resource.ProviderConfigUsage { 25 | items := make([]resource.ProviderConfigUsage, len(p.Items)) 26 | for i := range p.Items { 27 | items[i] = &p.Items[i] 28 | } 29 | return items 30 | } 31 | -------------------------------------------------------------------------------- /apis/register.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package apis contains Kubernetes API for argocd API. 18 | package apis 19 | 20 | import ( 21 | "k8s.io/apimachinery/pkg/runtime" 22 | 23 | clusterapis "github.com/crossplane-contrib/provider-argocd/apis/cluster" 24 | namespaceapis "github.com/crossplane-contrib/provider-argocd/apis/cluster" 25 | ) 26 | 27 | func init() { 28 | // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back 29 | AddToSchemes = append(AddToSchemes, 30 | clusterapis.AddToScheme, 31 | namespaceapis.AddToScheme, 32 | ) 33 | } 34 | 35 | // AddToSchemes may be used to add all resources defined in the project to a Scheme 36 | var AddToSchemes runtime.SchemeBuilder 37 | 38 | // AddToScheme adds all Resources to the Scheme 39 | func AddToScheme(s *runtime.Scheme) error { 40 | return AddToSchemes.AddToScheme(s) 41 | } 42 | -------------------------------------------------------------------------------- /cluster/images/provider-argocd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gcr.io/distroless/static@sha256:1f580b0a1922c3e54ae15b0758b5747b260bd99d39d40c2edb3e7f6e2452298b 2 | 3 | ARG TARGETOS 4 | ARG TARGETARCH 5 | 6 | ADD bin/$TARGETOS\_$TARGETARCH/provider /usr/local/bin/crossplane-argocd-provider 7 | 8 | USER 65532 9 | ENTRYPOINT ["crossplane-argocd-provider"] -------------------------------------------------------------------------------- /cluster/images/provider-argocd/Makefile: -------------------------------------------------------------------------------- 1 | # ==================================================================================== 2 | # Setup Project 3 | 4 | include ../../../build/makelib/common.mk 5 | 6 | # ==================================================================================== 7 | # Options 8 | 9 | include ../../../build/makelib/imagelight.mk 10 | 11 | # ==================================================================================== 12 | # Targets 13 | 14 | img.build: 15 | @$(INFO) docker build $(IMAGE) 16 | @$(MAKE) BUILD_ARGS="--load" img.build.shared 17 | @$(OK) docker build $(IMAGE) 18 | 19 | img.publish: 20 | @$(INFO) Skipping image publish for $(IMAGE) 21 | @echo Publish is deferred to xpkg machinery 22 | @$(OK) Image publish skipped for $(IMAGE) 23 | 24 | img.build.shared: 25 | @cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL) 26 | @cp -r $(OUTPUT_DIR)/bin/ $(IMAGE_TEMP_DIR)/bin || $(FAIL) 27 | @docker buildx build $(BUILD_ARGS) \ 28 | --platform $(IMAGE_PLATFORMS) \ 29 | -t $(IMAGE) \ 30 | $(IMAGE_TEMP_DIR) || $(FAIL) 31 | 32 | img.promote: 33 | @$(INFO) Skipping image promotion from $(FROM_IMAGE) to $(TO_IMAGE) 34 | @echo Promote is deferred to xpkg machinery 35 | @$(OK) Image promotion skipped for $(FROM_IMAGE) to $(TO_IMAGE) -------------------------------------------------------------------------------- /examples/application/application-kubeconfig.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Example using a KubeconfigSecretRef 3 | apiVersion: applications.argocd.crossplane.io/v1alpha1 4 | kind: Application 5 | metadata: 6 | name: example-application-kubeconfig 7 | spec: 8 | providerConfigRef: 9 | name: argocd-provider 10 | forProvider: 11 | destination: 12 | namespace: default 13 | name: example-cluster-kubeconfig 14 | project: default 15 | source: 16 | repoURL: https://github.com/stefanprodan/podinfo/ 17 | path: charts/podinfo 18 | targetRevision: HEAD 19 | -------------------------------------------------------------------------------- /examples/application/application-with-annotations.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Example using annotations 3 | apiVersion: applications.argocd.crossplane.io/v1alpha1 4 | kind: Application 5 | metadata: 6 | name: example-application-annotations 7 | spec: 8 | providerConfigRef: 9 | name: argocd-provider 10 | forProvider: 11 | annotations: 12 | notifications.argoproj.io/subscribe.on-deployed.slack: slack-channel-name 13 | notifications.argoproj.io/subscribe.on-failure.slack: slack-channel-name 14 | destination: 15 | namespace: default 16 | server: https://kubernetes.default.svc 17 | project: default 18 | source: 19 | repoURL: https://github.com/bonilla-cesar/argocd 20 | path: resources/cm 21 | targetRevision: HEAD 22 | 23 | -------------------------------------------------------------------------------- /examples/application/application-with-finalizers.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Example using finalizers 3 | apiVersion: applications.argocd.crossplane.io/v1alpha1 4 | kind: Application 5 | metadata: 6 | name: example-application-finalizers 7 | spec: 8 | providerConfigRef: 9 | name: argocd-provider 10 | forProvider: 11 | finalizers: 12 | - resources-finalizer.argocd.argoproj.io 13 | destination: 14 | namespace: default 15 | server: https://kubernetes.default.svc 16 | project: default 17 | source: 18 | repoURL: https://github.com/bonilla-cesar/argocd 19 | path: resources/cm 20 | targetRevision: HEAD 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/application/application-with-references.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Example using a KubeconfigSecretRef 3 | apiVersion: applications.argocd.crossplane.io/v1alpha1 4 | kind: Application 5 | metadata: 6 | name: example-application-server-name-ref 7 | spec: 8 | providerConfigRef: 9 | name: argocd-provider 10 | forProvider: 11 | destination: 12 | namespace: default 13 | serverSelector: 14 | matchLabels: 15 | purpose: dev 16 | project: default 17 | source: 18 | repoURL: https://github.com/stefanprodan/podinfo/ 19 | path: charts/podinfo 20 | targetRevision: HEAD 21 | --- 22 | apiVersion: applications.argocd.crossplane.io/v1alpha1 23 | kind: Application 24 | metadata: 25 | name: example-application-destination-name-ref 26 | spec: 27 | providerConfigRef: 28 | name: argocd-provider 29 | forProvider: 30 | destination: 31 | namespace: default 32 | nameSelector: 33 | matchLabels: 34 | purpose: dev 35 | project: default 36 | source: 37 | repoURL: https://github.com/stefanprodan/podinfo/ 38 | path: charts/podinfo 39 | targetRevision: HEAD 40 | -------------------------------------------------------------------------------- /examples/application/application.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: applications.argocd.crossplane.io/v1alpha1 3 | kind: Application 4 | metadata: 5 | name: example-application 6 | spec: 7 | providerConfigRef: 8 | name: argocd-provider 9 | forProvider: 10 | destination: 11 | namespace: default 12 | server: https://kubernetes.default.svc 13 | project: default 14 | source: 15 | repoURL: https://github.com/stefanprodan/podinfo/ 16 | path: charts/podinfo 17 | targetRevision: HEAD 18 | -------------------------------------------------------------------------------- /examples/applicationset/applicationset-with-ref.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: applicationsets.argocd.crossplane.io/v1alpha1 3 | kind: ApplicationSet 4 | metadata: 5 | name: example-application-ref 6 | spec: 7 | providerConfigRef: 8 | name: argocd-provider 9 | forProvider: 10 | generators: 11 | - list: 12 | elements: 13 | - cluster: engineering-dev 14 | - cluster: engineering-prod 15 | template: 16 | metadata: 17 | name: '{{cluster}}-guestbook' 18 | spec: 19 | project: default 20 | syncPolicy: 21 | syncOptions: 22 | - CreateNamespace=true 23 | automated: 24 | prune: true 25 | selfHeal: true 26 | source: 27 | repoURL: https://github.com/argoproj/argo-cd.git 28 | targetRevision: HEAD 29 | path: applicationset/examples/list-generator/guestbook/{{cluster}} 30 | destination: 31 | namespace: guestbook-{{cluster}} 32 | nameSelector: 33 | matchLabels: 34 | purpose: dev 35 | 36 | -------------------------------------------------------------------------------- /examples/applicationset/applicationset.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: applicationsets.argocd.crossplane.io/v1alpha1 3 | kind: ApplicationSet 4 | metadata: 5 | name: example-application 6 | spec: 7 | providerConfigRef: 8 | name: argocd-provider 9 | forProvider: 10 | generators: 11 | - list: 12 | elements: 13 | - cluster: engineering-dev 14 | - cluster: engineering-prod 15 | template: 16 | metadata: 17 | name: '{{cluster}}-guestbook' 18 | spec: 19 | project: default 20 | syncPolicy: 21 | syncOptions: 22 | - CreateNamespace=true 23 | automated: 24 | prune: true 25 | selfHeal: true 26 | source: 27 | repoURL: https://github.com/argoproj/argo-cd.git 28 | targetRevision: HEAD 29 | path: applicationset/examples/list-generator/guestbook/{{cluster}} 30 | destination: 31 | namespace: guestbook-{{cluster}} 32 | name: in-cluster 33 | 34 | -------------------------------------------------------------------------------- /examples/cluster/cluster-kubeconfig.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: cluster.argocd.crossplane.io/v1alpha1 3 | kind: Cluster 4 | metadata: 5 | name: example-cluster-kubeconfig 6 | labels: 7 | purpose: dev 8 | spec: 9 | forProvider: 10 | name: example-cluster-kubeconfig 11 | config: 12 | kubeconfigSecretRef: 13 | name: cluster-conn 14 | namespace: crossplane-system 15 | key: kubeconfig 16 | providerConfigRef: 17 | name: argocd-provider 18 | -------------------------------------------------------------------------------- /examples/cluster/cluster.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: cluster.argocd.crossplane.io/v1alpha1 3 | kind: Cluster 4 | metadata: 5 | name: example-cluster 6 | spec: 7 | forProvider: 8 | server: https://kubernetes.default.svc 9 | name: example-cluster 10 | config: 11 | tlsClientConfig: 12 | insecure: true 13 | providerConfigRef: 14 | name: argocd-provider 15 | -------------------------------------------------------------------------------- /examples/projects/project-with-source-namespaces.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: projects.argocd.crossplane.io/v1alpha1 3 | kind: Project 4 | metadata: 5 | name: example-project 6 | spec: 7 | forProvider: 8 | sourceNamespaces: 9 | - default 10 | projectLabels: 11 | argocd.crossplane.io/global-project: "true" 12 | providerConfigRef: 13 | name: argocd-provider 14 | -------------------------------------------------------------------------------- /examples/projects/project.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: projects.argocd.crossplane.io/v1alpha1 3 | kind: Project 4 | metadata: 5 | name: example-project 6 | annotations: 7 | crossplane.io/external-name: example-project-name 8 | spec: 9 | forProvider: 10 | projectLabels: 11 | argocd.crossplane.io/global-project: "true" 12 | providerConfigRef: 13 | name: argocd-provider 14 | -------------------------------------------------------------------------------- /examples/projects/token.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: projects.argocd.crossplane.io/v1alpha1 3 | kind: Token 4 | metadata: 5 | name: example-token 6 | spec: 7 | forProvider: 8 | project: example-project 9 | role: example-role 10 | id: example-token 11 | -------------------------------------------------------------------------------- /examples/providerconfig/provider.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # argocd provider that references the secret credentials 3 | apiVersion: argocd.crossplane.io/v1alpha1 4 | kind: ProviderConfig 5 | metadata: 6 | name: argocd-provider 7 | spec: 8 | serverAddr: argocd-server.argocd.svc:443 9 | insecure: true 10 | plainText: false 11 | credentials: 12 | source: Secret 13 | secretRef: 14 | namespace: crossplane-system 15 | name: argocd-credentials 16 | key: authToken 17 | --- 18 | # argocd provider that uses gRPC-web 19 | apiVersion: argocd.crossplane.io/v1alpha1 20 | kind: ProviderConfig 21 | metadata: 22 | name: argocd-provider 23 | spec: 24 | serverAddr: argocd-server.argocd.svc:443 25 | insecure: true 26 | plainText: false 27 | grpcWeb: true 28 | grpcWebRootPath: / 29 | credentials: 30 | source: Secret 31 | secretRef: 32 | namespace: crossplane-system 33 | name: argocd-credentials 34 | key: authToken 35 | --- 36 | # argocd provider that uses AzureWorkloadIdentity authentication 37 | apiVersion: argocd.crossplane.io/v1alpha1 38 | kind: ProviderConfig 39 | metadata: 40 | name: argocd-provider 41 | spec: 42 | serverAddr: argocd-server.argocd.svc:443 43 | credentials: 44 | source: AzureWorkloadIdentity 45 | audiences: 46 | - argocd-server.argocd.svc/.default 47 | azureWorkloadIdentityOptions: 48 | clientID: # Optional, defaults to env var 49 | tenantID: # Optional, defaults to env var 50 | tokenFilePath: # Optional, defaults to env var 51 | -------------------------------------------------------------------------------- /examples/repositories/repository.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: repositories.argocd.crossplane.io/v1alpha1 3 | kind: Repository 4 | metadata: 5 | name: example-project.git 6 | spec: 7 | forProvider: 8 | repo: https://gitlab.com/example-group/example-project.git 9 | type: git 10 | username: example-user 11 | passwordRef: 12 | name: example-project.git 13 | namespace: crossplane-system 14 | key: token 15 | providerConfigRef: 16 | name: argocd-provider 17 | --- 18 | apiVersion: repositories.argocd.crossplane.io/v1alpha1 19 | kind: Repository 20 | metadata: 21 | name: example-scoped-project.git 22 | spec: 23 | forProvider: 24 | project: example-project # project scoped repository 25 | repo: https://gitlab.com/example-group/example-project-scoped.git 26 | type: git 27 | username: example-user 28 | passwordRef: 29 | name: example-project.git 30 | namespace: crossplane-system 31 | key: token 32 | providerConfigRef: 33 | name: argocd-provider 34 | -------------------------------------------------------------------------------- /hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /hack/helpers/addtype.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2022 The Crossplane Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Please set ProviderNameLower & ProviderNameUpper environment variables before running this script. 18 | # See: https://github.com/crossplane/terrajet/blob/main/docs/generating-a-provider.md 19 | set -euo pipefail 20 | 21 | APIVERSION="${APIVERSION:-v1alpha1}" 22 | echo "Adding type ${KIND} to group ${GROUP} with version ${APIVERSION}" 23 | 24 | export GROUP 25 | export KIND 26 | export APIVERSION 27 | export PROVIDER 28 | export PROJECT_REPO 29 | 30 | kind_lower=$(echo "${KIND}" | tr "[:upper:]" "[:lower:]") 31 | group_lower=$(echo "${GROUP}" | tr "[:upper:]" "[:lower:]") 32 | 33 | mkdir -p "apis/${group_lower}/${APIVERSION}" 34 | ${GOMPLATE} < "hack/helpers/apis/GROUP_LOWER/GROUP_LOWER.go.tmpl" > "apis/${group_lower}/${group_lower}.go" 35 | ${GOMPLATE} < "hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl" > "apis/${group_lower}/${APIVERSION}/${kind_lower}_types.go" 36 | ${GOMPLATE} < "hack/helpers/apis/GROUP_LOWER/APIVERSION/doc.go.tmpl" > "apis/${group_lower}/${APIVERSION}/doc.go" 37 | ${GOMPLATE} < "hack/helpers/apis/GROUP_LOWER/APIVERSION/groupversion_info.go.tmpl" > "apis/${group_lower}/${APIVERSION}/groupversion_info.go" 38 | 39 | mkdir -p "pkg/controller/${kind_lower}" 40 | ${GOMPLATE} < "hack/helpers/controller/KIND_LOWER/KIND_LOWER.go.tmpl" > "pkg/controller/${kind_lower}/${kind_lower}.go" 41 | ${GOMPLATE} < "hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl" > "pkg/controller/${kind_lower}/${kind_lower}_test.go" 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /hack/helpers/apis/GROUP_LOWER/APIVERSION/KIND_LOWER_types.go.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package {{ .Env.APIVERSION }} 18 | 19 | import ( 20 | "reflect" 21 | 22 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 | "k8s.io/apimachinery/pkg/runtime/schema" 24 | 25 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 26 | ) 27 | 28 | // {{ .Env.KIND }}Parameters are the configurable fields of a {{ .Env.KIND }}. 29 | type {{ .Env.KIND }}Parameters struct { 30 | ConfigurableField string `json:"configurableField"` 31 | } 32 | 33 | // {{ .Env.KIND }}Observation are the observable fields of a {{ .Env.KIND }}. 34 | type {{ .Env.KIND }}Observation struct { 35 | ObservableField string `json:"observableField,omitempty"` 36 | } 37 | 38 | // A {{ .Env.KIND }}Spec defines the desired state of a {{ .Env.KIND }}. 39 | type {{ .Env.KIND }}Spec struct { 40 | xpv1.ResourceSpec `json:",inline"` 41 | ForProvider {{ .Env.KIND }}Parameters `json:"forProvider"` 42 | } 43 | 44 | // A {{ .Env.KIND }}Status represents the observed state of a {{ .Env.KIND }}. 45 | type {{ .Env.KIND }}Status struct { 46 | xpv1.ResourceStatus `json:",inline"` 47 | AtProvider {{ .Env.KIND }}Observation `json:"atProvider,omitempty"` 48 | } 49 | 50 | // +kubebuilder:object:root=true 51 | 52 | // A {{ .Env.KIND }} is an example API type. 53 | // +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" 54 | // +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" 55 | // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" 56 | // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" 57 | // +kubebuilder:subresource:status 58 | // +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,{{ .Env.PROVIDER | strings.ToLower }}} 59 | type {{ .Env.KIND }} struct { 60 | metav1.TypeMeta `json:",inline"` 61 | metav1.ObjectMeta `json:"metadata,omitempty"` 62 | 63 | Spec {{ .Env.KIND }}Spec `json:"spec"` 64 | Status {{ .Env.KIND }}Status `json:"status,omitempty"` 65 | } 66 | 67 | // +kubebuilder:object:root=true 68 | 69 | // {{ .Env.KIND }}List contains a list of {{ .Env.KIND }} 70 | type {{ .Env.KIND }}List struct { 71 | metav1.TypeMeta `json:",inline"` 72 | metav1.ListMeta `json:"metadata,omitempty"` 73 | Items []{{ .Env.KIND }} `json:"items"` 74 | } 75 | 76 | // {{ .Env.KIND }} type metadata. 77 | var ( 78 | {{ .Env.KIND }}Kind = reflect.TypeOf({{ .Env.KIND }}{}).Name() 79 | {{ .Env.KIND }}GroupKind = schema.GroupKind{Group: Group, Kind: {{ .Env.KIND }}Kind}.String() 80 | {{ .Env.KIND }}KindAPIVersion = {{ .Env.KIND }}Kind + "." + SchemeGroupVersion.String() 81 | {{ .Env.KIND }}GroupVersionKind = SchemeGroupVersion.WithKind({{ .Env.KIND }}Kind) 82 | ) 83 | 84 | func init() { 85 | SchemeBuilder.Register(&{{ .Env.KIND }}{}, &{{ .Env.KIND }}List{}) 86 | } 87 | -------------------------------------------------------------------------------- /hack/helpers/apis/GROUP_LOWER/APIVERSION/doc.go.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package {{ .Env.APIVERSION | strings.ToLower }} 18 | -------------------------------------------------------------------------------- /hack/helpers/apis/GROUP_LOWER/APIVERSION/groupversion_info.go.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1alpha1 contains the v1alpha1 group Sample resources of the {{ .Env.PROVIDER }} provider. 18 | // +kubebuilder:object:generate=true 19 | // +groupName={{ .Env.GROUP | strings.ToLower }}.{{ .Env.PROVIDER | strings.ToLower }}.crossplane.io 20 | // +versionName={{ .Env.APIVERSION | strings.ToLower }} 21 | package {{ .Env.APIVERSION | strings.ToLower }} 22 | 23 | import ( 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | "sigs.k8s.io/controller-runtime/pkg/scheme" 26 | ) 27 | 28 | // Package type metadata. 29 | const ( 30 | Group = "{{ .Env.GROUP | strings.ToLower }}.{{ .Env.PROVIDER | strings.ToLower }}.crossplane.io" 31 | Version = "{{ .Env.APIVERSION | strings.ToLower }}" 32 | ) 33 | 34 | var ( 35 | // SchemeGroupVersion is group version used to register these objects 36 | SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version} 37 | 38 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme 39 | SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} 40 | ) 41 | -------------------------------------------------------------------------------- /hack/helpers/apis/GROUP_LOWER/GROUP_LOWER.go.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package {{ .Env.GROUP | strings.ToLower }} contains group {{ .Env.GROUP }} API versions 18 | package {{ .Env.GROUP | strings.ToLower }} 19 | -------------------------------------------------------------------------------- /hack/helpers/controller/KIND_LOWER/KIND_LOWER_test.go.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package {{ .Env.KIND | strings.ToLower }} 18 | 19 | import ( 20 | "context" 21 | "testing" 22 | 23 | "github.com/google/go-cmp/cmp" 24 | 25 | "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" 26 | "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 27 | "github.com/crossplane/crossplane-runtime/v2/pkg/test" 28 | ) 29 | 30 | // Unlike many Kubernetes projects Crossplane does not use third party testing 31 | // libraries, per the common Go test review comments. Crossplane encourages the 32 | // use of table driven unit tests. The tests of the crossplane-runtime project 33 | // are representative of the testing style Crossplane encourages. 34 | // 35 | // https://github.com/golang/go/wiki/TestComments 36 | // https://github.com/crossplane/crossplane/blob/master/CONTRIBUTING.md#contributing-code 37 | 38 | func TestObserve(t *testing.T) { 39 | type fields struct { 40 | service interface{} 41 | } 42 | 43 | type args struct { 44 | ctx context.Context 45 | mg resource.Managed 46 | } 47 | 48 | type want struct { 49 | o managed.ExternalObservation 50 | err error 51 | } 52 | 53 | cases := map[string]struct { 54 | reason string 55 | fields fields 56 | args args 57 | want want 58 | }{ 59 | // TODO: Add test cases. 60 | } 61 | 62 | for name, tc := range cases { 63 | t.Run(name, func(t *testing.T) { 64 | e := external{service: tc.fields.service} 65 | got, err := e.Observe(tc.args.ctx, tc.args.mg) 66 | if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" { 67 | t.Errorf("\n%s\ne.Observe(...): -want error, +got error:\n%s\n", tc.reason, diff) 68 | } 69 | if diff := cmp.Diff(tc.want.o, got); diff != "" { 70 | t.Errorf("\n%s\ne.Observe(...): -want, +got:\n%s\n", tc.reason, diff) 71 | } 72 | }) 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /hack/linter-violation.tmpl: -------------------------------------------------------------------------------- 1 | `{{violation.rule}}`: {{violation.message}} 2 | 3 | Refer to Crossplane's [coding style documentation](https://github.com/crossplane/crossplane/blob/master/CONTRIBUTING.md#coding-style-and-linting) for more information. -------------------------------------------------------------------------------- /hack/local-argocd-setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Debug 4 | #set -x 5 | # Be defensive 6 | set -euo pipefail 7 | # -m Job control is enabled 8 | set -m 9 | 10 | GREEN="\033[1;32m" 11 | NOCOLOR="\033[0m" 12 | 13 | logInfo () { echo -e "${GREEN}[INFO] $@ ${NOCOLOR}"; } 14 | 15 | 16 | logInfo "Waiting for Argo CD to become available." 17 | kubectl wait --for condition=available --namespace argocd deployment.apps --all --timeout=300s 18 | 19 | logInfo "Patching configmaps" 20 | kubectl patch configmap/argocd-cm \ 21 | -n argocd \ 22 | --type merge \ 23 | -p '{"data":{"accounts.provider-argocd":"apiKey"}}' 24 | 25 | kubectl patch configmap/argocd-rbac-cm \ 26 | -n argocd \ 27 | --type merge \ 28 | -p '{"data":{"policy.csv":"g, provider-argocd, role:admin"}}' 29 | 30 | 31 | ARGOCD_ADMIN_SECRET=$(kubectl get secrets argocd-initial-admin-secret -n argocd -o json | jq .data.password -r |base64 -d) 32 | logInfo "Activating port forwarding to Argo CD to http://localhost:8443" 33 | kubectl -n argocd port-forward svc/argocd-server 8443:443 & 34 | 35 | logInfo "Waiting for port forwarding to become available" 36 | while ! curl --output /dev/null --silent --head --fail http://localhost:8443; do sleep 0.1 && echo -n .; done; 37 | 38 | 39 | ARGOCD_ADMIN_TOKEN=$(curl -s -X POST -k -H "Content-Type: application/json" --data '{"username":"admin","password":"'"$ARGOCD_ADMIN_SECRET"'"}' https://localhost:8443/api/v1/session | jq -r .token) 40 | ARGOCD_PROVIDER_USER="provider-argocd" 41 | ARGOCD_TOKEN=$(curl -s -X POST -k -H "Authorization: Bearer $ARGOCD_ADMIN_TOKEN" -H "Content-Type: application/json" https://localhost:8443/api/v1/account/$ARGOCD_PROVIDER_USER/token | jq -r .token) 42 | logInfo "Creating ArgoCD provider credential" 43 | kubectl create secret generic --dry-run=client --save-config argocd-credentials -n crossplane-system --from-literal=authToken="$ARGOCD_TOKEN" -o yaml | kubectl apply -f - 44 | logInfo "Applying provider config " 45 | cat << EOF | kubectl apply -f - 46 | apiVersion: argocd.crossplane.io/v1alpha1 47 | kind: ProviderConfig 48 | metadata: 49 | name: argocd-provider 50 | spec: 51 | serverAddr: localhost:8443 52 | insecure: true 53 | plainText: false 54 | credentials: 55 | source: Secret 56 | secretRef: 57 | namespace: crossplane-system 58 | name: argocd-credentials 59 | key: authToken 60 | EOF 61 | logInfo "Username: admin" 62 | logInfo "Password: $ARGOCD_ADMIN_SECRET" 63 | logInfo "Port Forwarding to Argo CD at http://localhost:8443." 64 | logInfo "ctrl-c to abort, happy developing 🧑‍💻🦄" 65 | 66 | fg 67 | -------------------------------------------------------------------------------- /package/crds/m.argocd.crossplane.io_providerconfigusages.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | controller-gen.kubebuilder.io/version: v0.18.0 7 | name: providerconfigusages.m.argocd.crossplane.io 8 | spec: 9 | group: m.argocd.crossplane.io 10 | names: 11 | categories: 12 | - crossplane 13 | - provider 14 | - argocd 15 | kind: ProviderConfigUsage 16 | listKind: ProviderConfigUsageList 17 | plural: providerconfigusages 18 | singular: providerconfigusage 19 | scope: Namespaced 20 | versions: 21 | - additionalPrinterColumns: 22 | - jsonPath: .metadata.creationTimestamp 23 | name: AGE 24 | type: date 25 | - jsonPath: .providerConfigRef.name 26 | name: CONFIG-NAME 27 | type: string 28 | - jsonPath: .resourceRef.kind 29 | name: RESOURCE-KIND 30 | type: string 31 | - jsonPath: .resourceRef.name 32 | name: RESOURCE-NAME 33 | type: string 34 | name: v1alpha1 35 | schema: 36 | openAPIV3Schema: 37 | description: A ProviderConfigUsage indicates that a resource is using a ProviderConfig. 38 | properties: 39 | apiVersion: 40 | description: |- 41 | APIVersion defines the versioned schema of this representation of an object. 42 | Servers should convert recognized schemas to the latest internal value, and 43 | may reject unrecognized values. 44 | More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources 45 | type: string 46 | kind: 47 | description: |- 48 | Kind is a string value representing the REST resource this object represents. 49 | Servers may infer this from the endpoint the client submits requests to. 50 | Cannot be updated. 51 | In CamelCase. 52 | More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 53 | type: string 54 | metadata: 55 | type: object 56 | providerConfigRef: 57 | description: ProviderConfigReference to the provider config being used. 58 | properties: 59 | kind: 60 | description: Kind of the referenced object. 61 | type: string 62 | name: 63 | description: Name of the referenced object. 64 | type: string 65 | required: 66 | - kind 67 | - name 68 | type: object 69 | resourceRef: 70 | description: ResourceReference to the managed resource using the provider 71 | config. 72 | properties: 73 | apiVersion: 74 | description: APIVersion of the referenced object. 75 | type: string 76 | kind: 77 | description: Kind of the referenced object. 78 | type: string 79 | name: 80 | description: Name of the referenced object. 81 | type: string 82 | uid: 83 | description: UID of the referenced object. 84 | type: string 85 | required: 86 | - apiVersion 87 | - kind 88 | - name 89 | type: object 90 | required: 91 | - providerConfigRef 92 | - resourceRef 93 | type: object 94 | served: true 95 | storage: true 96 | subresources: {} 97 | -------------------------------------------------------------------------------- /package/crossplane.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: meta.pkg.crossplane.io/v1 2 | kind: Provider 3 | metadata: 4 | name: provider-argocd 5 | annotations: 6 | meta.crossplane.io/maintainer: Crossplane Maintainers 7 | meta.crossplane.io/source: github.com/crossplane-contrib/provider-argocd 8 | meta.crossplane.io/license: Apache-2.0 9 | meta.crossplane.io/description: | 10 | The argocd Crossplane provider enables resources management for Argo CD. 11 | meta.crossplane.io/readme: | 12 | `provider-argocd` is the Crossplane infrastructure provider for 13 | [Argo CD](https://argo-cd.readthedocs.io/). 14 | Available resources and their fields can be found in the [CRD 15 | Docs](https://marketplace.upbound.io/providers/crossplane-contrib/provider-argocd/latest/crds). 16 | If you encounter an issue please reach out on 17 | [slack.crossplane.io](https://slack.crossplane.io) and create an issue in 18 | the [crossplane-contrib/provider-argocd](https://github.com/crossplane-contrib/provider-argocd) 19 | repo. 20 | friendly-name.meta.crossplane.io: Provider Argo CD 21 | -------------------------------------------------------------------------------- /pkg/clients/cluster/converter/applications/conversions.go: -------------------------------------------------------------------------------- 1 | package converter 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 7 | extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" 8 | "k8s.io/apimachinery/pkg/runtime" 9 | 10 | "github.com/crossplane-contrib/provider-argocd/apis/cluster/applications/v1alpha1" 11 | ) 12 | 13 | // Converter helps to convert ArgoCD types to api types of this provider and vise-versa 14 | // From & To shall both be defined for each type conversion, to prevent diverge from ArgoCD Types 15 | // goverter:converter 16 | // goverter:useZeroValueOnPointerInconsistency 17 | // goverter:ignoreUnexported 18 | // goverter:extend ExtV1JSONToRuntimeRawExtension 19 | // goverter:extend PV1alpha1HealthStatusToPV1alpha1HealthStatus 20 | // goverter:enum:unknown @ignore 21 | // goverter:struct:comment // +k8s:deepcopy-gen=false 22 | // goverter:output:file ./zz_generated.conversion.go 23 | // goverter:output:package github.com/crossplane-contrib/provider-argocd/pkg/clients/cluster/converter/applications 24 | // +k8s:deepcopy-gen=false 25 | type Converter interface { 26 | 27 | // goverter:ignore ServerRef 28 | // goverter:ignore ServerSelector 29 | // goverter:ignore NameRef 30 | // goverter:ignore NameSelector 31 | FromArgoDestination(in argocdv1alpha1.ApplicationDestination) v1alpha1.ApplicationDestination 32 | 33 | ToArgoDestination(in v1alpha1.ApplicationDestination) argocdv1alpha1.ApplicationDestination 34 | 35 | ToArgoApplicationSpec(in *v1alpha1.ApplicationParameters) *argocdv1alpha1.ApplicationSpec 36 | 37 | FromArgoApplicationStatus(in *argocdv1alpha1.ApplicationStatus) *v1alpha1.ArgoApplicationStatus 38 | } 39 | 40 | // ExtV1JSONToRuntimeRawExtension converts an extv1.JSON into a 41 | // *runtime.RawExtension. 42 | func ExtV1JSONToRuntimeRawExtension(in extv1.JSON) *runtime.RawExtension { 43 | return &runtime.RawExtension{ 44 | Raw: in.Raw, 45 | } 46 | } 47 | 48 | func PV1alpha1HealthStatusToPV1alpha1HealthStatus(source *v1alpha1.HealthStatus) *argocdv1alpha1.HealthStatus { 49 | raw, _ := json.Marshal(source) //nolint:errchkjson // should never happen 50 | out := &argocdv1alpha1.HealthStatus{} 51 | _ = json.Unmarshal(raw, out) 52 | return out 53 | } 54 | -------------------------------------------------------------------------------- /pkg/clients/cluster/converter/applicationsets/conversions.go: -------------------------------------------------------------------------------- 1 | package applicationsets 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 7 | extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" 8 | "k8s.io/apimachinery/pkg/runtime" 9 | 10 | "github.com/crossplane-contrib/provider-argocd/apis/cluster/applicationsets/v1alpha1" 11 | ) 12 | 13 | // Converter helps to convert ArgoCD types to api types of this provider and vise-versa 14 | // From & To shall both be defined for each type conversion, to prevent diverge from ArgoCD Types 15 | // goverter:converter 16 | // goverter:useZeroValueOnPointerInconsistency 17 | // goverter:ignoreUnexported 18 | // goverter:extend ExtV1JSONToRuntimeRawExtension 19 | // goverter:extend PV1alpha1HealthStatusToPV1alpha1HealthStatus 20 | // goverter:enum:unknown @ignore 21 | // goverter:struct:comment // +k8s:deepcopy-gen=false 22 | // goverter:output:file ./zz_generated.conversion.go 23 | // goverter:output:package github.com/crossplane-contrib/provider-argocd/pkg/clients/cluster/converter/applicationsets 24 | // +k8s:deepcopy-gen=false 25 | type Converter interface { 26 | 27 | // goverter:ignore ServerRef 28 | // goverter:ignore ServerSelector 29 | // goverter:ignore NameRef 30 | // goverter:ignore NameSelector 31 | FromArgoDestination(in argocdv1alpha1.ApplicationDestination) v1alpha1.ApplicationDestination 32 | 33 | ToArgoDestination(in v1alpha1.ApplicationDestination) argocdv1alpha1.ApplicationDestination 34 | 35 | ToArgoApplicationSetSpec(in *v1alpha1.ApplicationSetParameters) *argocdv1alpha1.ApplicationSetSpec 36 | // goverter:ignore AppsetNamespace 37 | FromArgoApplicationSetSpec(in *argocdv1alpha1.ApplicationSetSpec) *v1alpha1.ApplicationSetParameters 38 | 39 | FromArgoApplicationSetStatus(in *argocdv1alpha1.ApplicationSetStatus) *v1alpha1.ArgoApplicationSetStatus 40 | ToArgoApplicationSetStatus(in *v1alpha1.ArgoApplicationSetStatus) *argocdv1alpha1.ApplicationSetStatus 41 | } 42 | 43 | // ExtV1JSONToRuntimeRawExtension converts an extv1.JSON into a 44 | // *runtime.RawExtension. 45 | func ExtV1JSONToRuntimeRawExtension(in extv1.JSON) *runtime.RawExtension { 46 | return &runtime.RawExtension{ 47 | Raw: in.Raw, 48 | } 49 | } 50 | 51 | func PV1alpha1HealthStatusToPV1alpha1HealthStatus(source *v1alpha1.HealthStatus) *argocdv1alpha1.HealthStatus { 52 | raw, _ := json.Marshal(source) //nolint:errchkjson // should never happen 53 | out := &argocdv1alpha1.HealthStatus{} 54 | _ = json.Unmarshal(raw, out) 55 | return out 56 | } 57 | -------------------------------------------------------------------------------- /pkg/clients/cluster/converter/generate.go: -------------------------------------------------------------------------------- 1 | package converter 2 | 3 | // Generate conversion code 4 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/jmattheis/goverter/cmd/goverter gen -output-constraint !ignore_autogenerated ./... 5 | -------------------------------------------------------------------------------- /pkg/clients/generate.go: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | 3 | /* 4 | Copyright 2024 The Crossplane Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package clients 20 | -------------------------------------------------------------------------------- /pkg/clients/interface/applications/client.go: -------------------------------------------------------------------------------- 1 | package applications 2 | 3 | import ( 4 | "context" 5 | "strings" 6 | 7 | "github.com/argoproj/argo-cd/v3/pkg/apiclient" 8 | "github.com/argoproj/argo-cd/v3/pkg/apiclient/application" 9 | "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 10 | "github.com/argoproj/argo-cd/v3/util/io" 11 | "google.golang.org/grpc" 12 | ) 13 | 14 | const ( 15 | errorNotFound = "code = NotFound desc = repo" 16 | ) 17 | 18 | // ServiceClient wraps the functions to connect to argocd repositories 19 | type ServiceClient interface { 20 | // Get returns an application by name 21 | Get(ctx context.Context, in *application.ApplicationQuery, opts ...grpc.CallOption) (*v1alpha1.Application, error) 22 | 23 | // List returns list of applications 24 | List(ctx context.Context, in *application.ApplicationQuery, opts ...grpc.CallOption) (*v1alpha1.ApplicationList, error) 25 | 26 | // Create creates an application 27 | Create(ctx context.Context, in *application.ApplicationCreateRequest, opts ...grpc.CallOption) (*v1alpha1.Application, error) 28 | 29 | // Update updates an application 30 | Update(ctx context.Context, in *application.ApplicationUpdateRequest, opts ...grpc.CallOption) (*v1alpha1.Application, error) 31 | 32 | // Delete deletes an application 33 | Delete(ctx context.Context, in *application.ApplicationDeleteRequest, opts ...grpc.CallOption) (*application.ApplicationResponse, error) 34 | } 35 | 36 | // NewApplicationServiceClient creates a new API client from a set of config options, or fails fatally if the new client creation fails. 37 | func NewApplicationServiceClient(clientOpts *apiclient.ClientOptions) (io.Closer, ServiceClient) { 38 | conn, repoIf := apiclient.NewClientOrDie(clientOpts).NewApplicationClientOrDie() 39 | return conn, repoIf 40 | } 41 | 42 | // IsErrorApplicationNotFound helper function to test for errorNotFound error. 43 | func IsErrorApplicationNotFound(err error) bool { 44 | if err == nil { 45 | return false 46 | } 47 | return strings.Contains(err.Error(), errorNotFound) 48 | } 49 | -------------------------------------------------------------------------------- /pkg/clients/interface/applicationsets/client.go: -------------------------------------------------------------------------------- 1 | package applicationsets 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/argoproj/argo-cd/v3/pkg/apiclient" 7 | "github.com/argoproj/argo-cd/v3/pkg/apiclient/applicationset" 8 | "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 9 | argoGrpc "github.com/argoproj/argo-cd/v3/util/grpc" 10 | "github.com/argoproj/argo-cd/v3/util/io" 11 | "google.golang.org/grpc" 12 | "google.golang.org/grpc/codes" 13 | ) 14 | 15 | // ServiceClient wraps the functions to connect to argocd repositories 16 | type ServiceClient interface { 17 | // Get returns an applicationset by name 18 | Get(ctx context.Context, in *applicationset.ApplicationSetGetQuery, opts ...grpc.CallOption) (*v1alpha1.ApplicationSet, error) 19 | // List returns list of applicationset 20 | List(ctx context.Context, in *applicationset.ApplicationSetListQuery, opts ...grpc.CallOption) (*v1alpha1.ApplicationSetList, error) 21 | // Create creates an applicationset 22 | Create(ctx context.Context, in *applicationset.ApplicationSetCreateRequest, opts ...grpc.CallOption) (*v1alpha1.ApplicationSet, error) 23 | // Delete deletes an application set 24 | Delete(ctx context.Context, in *applicationset.ApplicationSetDeleteRequest, opts ...grpc.CallOption) (*applicationset.ApplicationSetResponse, error) 25 | } 26 | 27 | // NewApplicationSetServiceClient creates a new API client from a set of config options, or fails fatally if the new client creation fails. 28 | func NewApplicationSetServiceClient(clientOpts *apiclient.ClientOptions) (io.Closer, ServiceClient) { 29 | conn, repoIf := apiclient.NewClientOrDie(clientOpts).NewApplicationSetClientOrDie() 30 | return conn, repoIf 31 | } 32 | 33 | // IsNotFound returns true if the error code is NotFound 34 | func IsNotFound(err error) bool { 35 | unwrappedError := argoGrpc.UnwrapGRPCStatus(err).Code() 36 | return unwrappedError == codes.NotFound 37 | } 38 | -------------------------------------------------------------------------------- /pkg/clients/interface/cluster/client.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import ( 4 | "context" 5 | "strings" 6 | 7 | "github.com/argoproj/argo-cd/v3/pkg/apiclient" 8 | "github.com/argoproj/argo-cd/v3/pkg/apiclient/cluster" 9 | "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 10 | "github.com/argoproj/argo-cd/v3/util/io" 11 | "google.golang.org/grpc" 12 | ) 13 | 14 | const ( 15 | errorClusterNotFound = "code = NotFound desc = cluster" 16 | errorPermissionDenied = "code = PermissionDenied desc = permission denied" 17 | ) 18 | 19 | // ServiceClient wraps the functions to connect to argocd repositories 20 | type ServiceClient interface { 21 | // Create creates a cluster 22 | Create(ctx context.Context, in *cluster.ClusterCreateRequest, opts ...grpc.CallOption) (*v1alpha1.Cluster, error) 23 | // Get returns a cluster by server address 24 | Get(ctx context.Context, in *cluster.ClusterQuery, opts ...grpc.CallOption) (*v1alpha1.Cluster, error) 25 | // Update updates a cluster 26 | Update(ctx context.Context, in *cluster.ClusterUpdateRequest, opts ...grpc.CallOption) (*v1alpha1.Cluster, error) 27 | // Delete deletes a cluster 28 | Delete(ctx context.Context, in *cluster.ClusterQuery, opts ...grpc.CallOption) (*cluster.ClusterResponse, error) 29 | } 30 | 31 | // NewClusterServiceClient creates a new API client from a set of config options, or fails fatally if the new client creation fails. 32 | func NewClusterServiceClient(clientOpts *apiclient.ClientOptions) (io.Closer, cluster.ClusterServiceClient) { 33 | conn, repoIf := apiclient.NewClientOrDie(clientOpts).NewClusterClientOrDie() 34 | return conn, repoIf 35 | } 36 | 37 | // IsErrorClusterNotFound helper function to test for errorClusterNotFound error. 38 | func IsErrorClusterNotFound(err error) bool { 39 | if err == nil { 40 | return false 41 | } 42 | return strings.Contains(err.Error(), errorClusterNotFound) 43 | } 44 | 45 | // IsErrorPermissionDenied helper function to test for errorPermissionDenied error. 46 | func IsErrorPermissionDenied(err error) bool { 47 | if err == nil { 48 | return false 49 | } 50 | return strings.Contains(err.Error(), errorPermissionDenied) 51 | } 52 | -------------------------------------------------------------------------------- /pkg/clients/interface/clusters/client.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import ( 4 | "context" 5 | "strings" 6 | 7 | "github.com/argoproj/argo-cd/v3/pkg/apiclient" 8 | "github.com/argoproj/argo-cd/v3/pkg/apiclient/cluster" 9 | "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 10 | "github.com/argoproj/argo-cd/v3/util/io" 11 | "google.golang.org/grpc" 12 | ) 13 | 14 | const ( 15 | errorClusterNotFound = "code = NotFound desc = cluster" 16 | errorPermissionDenied = "code = PermissionDenied desc = permission denied" 17 | ) 18 | 19 | // ServiceClient wraps the functions to connect to argocd repositories 20 | type ServiceClient interface { 21 | // Create creates a cluster 22 | Create(ctx context.Context, in *cluster.ClusterCreateRequest, opts ...grpc.CallOption) (*v1alpha1.Cluster, error) 23 | // Get returns a cluster by server address 24 | Get(ctx context.Context, in *cluster.ClusterQuery, opts ...grpc.CallOption) (*v1alpha1.Cluster, error) 25 | // Update updates a cluster 26 | Update(ctx context.Context, in *cluster.ClusterUpdateRequest, opts ...grpc.CallOption) (*v1alpha1.Cluster, error) 27 | // Delete deletes a cluster 28 | Delete(ctx context.Context, in *cluster.ClusterQuery, opts ...grpc.CallOption) (*cluster.ClusterResponse, error) 29 | } 30 | 31 | // NewClusterServiceClient creates a new API client from a set of config options, or fails fatally if the new client creation fails. 32 | func NewClusterServiceClient(clientOpts *apiclient.ClientOptions) (io.Closer, cluster.ClusterServiceClient) { 33 | conn, repoIf := apiclient.NewClientOrDie(clientOpts).NewClusterClientOrDie() 34 | return conn, repoIf 35 | } 36 | 37 | // IsErrorClusterNotFound helper function to test for errorClusterNotFound error. 38 | func IsErrorClusterNotFound(err error) bool { 39 | if err == nil { 40 | return false 41 | } 42 | return strings.Contains(err.Error(), errorClusterNotFound) 43 | } 44 | 45 | // IsErrorPermissionDenied helper function to test for errorPermissionDenied error. 46 | func IsErrorPermissionDenied(err error) bool { 47 | if err == nil { 48 | return false 49 | } 50 | return strings.Contains(err.Error(), errorPermissionDenied) 51 | } 52 | -------------------------------------------------------------------------------- /pkg/clients/interface/mock/generate.go: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | 3 | package mock 4 | 5 | //go:generate go run -modfile ../../../../tools/go.mod -mod=mod go.uber.org/mock/mockgen -package application -destination=./applications/mock.go -source=../applications/client.go ServiceClient -build_flags=-mod=mod 6 | //go:generate go run -modfile ../../../../tools/go.mod -mod=mod go.uber.org/mock/mockgen -package projects -destination=./projects/mock.go -source=../projects/client.go ServiceClient -build_flags=-mod=mod 7 | //go:generate go run -modfile ../../../../tools/go.mod -mod=mod go.uber.org/mock/mockgen -package cluster -destination=./cluster/mock.go -source=../cluster/client.go ServiceClient -build_flags=-mod=mod 8 | //go:generate go run -modfile ../../../../tools/go.mod -mod=mod go.uber.org/mock/mockgen -package applicationsets -destination=./applicationsets/mock.go -source=../applicationsets/client.go ServiceClient -build_flags=-mod=mod 9 | //go:generate go run -modfile ../../../../tools/go.mod -mod=mod go.uber.org/mock/mockgen -package repositories -destination=./repositories/mock.go -source=../repositories/client.go ServiceClient -build_flags=-mod=mod 10 | -------------------------------------------------------------------------------- /pkg/clients/interface/projects/client.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | import ( 4 | "context" 5 | "strings" 6 | 7 | "github.com/argoproj/argo-cd/v3/pkg/apiclient" 8 | "github.com/argoproj/argo-cd/v3/pkg/apiclient/project" 9 | "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 10 | "github.com/argoproj/argo-cd/v3/util/io" 11 | "google.golang.org/grpc" 12 | ) 13 | 14 | const ( 15 | errorProjectNotFound = "code = NotFound desc = appprojects" 16 | ) 17 | 18 | // ProjectServiceClient wraps the functions to connect to argocd repositories 19 | type ProjectServiceClient interface { 20 | // Create a new project 21 | Create(ctx context.Context, in *project.ProjectCreateRequest, opts ...grpc.CallOption) (*v1alpha1.AppProject, error) 22 | // Get returns a project by name 23 | Get(ctx context.Context, in *project.ProjectQuery, opts ...grpc.CallOption) (*v1alpha1.AppProject, error) 24 | // Update updates a project 25 | Update(ctx context.Context, in *project.ProjectUpdateRequest, opts ...grpc.CallOption) (*v1alpha1.AppProject, error) 26 | // Delete deletes a project 27 | Delete(ctx context.Context, in *project.ProjectQuery, opts ...grpc.CallOption) (*project.EmptyResponse, error) 28 | // CreateToken a new project token 29 | CreateToken(ctx context.Context, in *project.ProjectTokenCreateRequest, opts ...grpc.CallOption) (*project.ProjectTokenResponse, error) 30 | // DeleteToken a new project token 31 | DeleteToken(ctx context.Context, in *project.ProjectTokenDeleteRequest, opts ...grpc.CallOption) (*project.EmptyResponse, error) 32 | } 33 | 34 | // NewProjectServiceClient creates a new API client from a set of config options, or fails fatally if the new client creation fails. 35 | func NewProjectServiceClient(clientOpts *apiclient.ClientOptions) (io.Closer, project.ProjectServiceClient) { 36 | conn, repoIf := apiclient.NewClientOrDie(clientOpts).NewProjectClientOrDie() 37 | return conn, repoIf 38 | } 39 | 40 | // IsErrorProjectNotFound helper function to test for errorProjectNotFound error. 41 | func IsErrorProjectNotFound(err error) bool { 42 | if err == nil { 43 | return false 44 | } 45 | return strings.Contains(err.Error(), errorProjectNotFound) 46 | } 47 | -------------------------------------------------------------------------------- /pkg/clients/interface/repositories/client.go: -------------------------------------------------------------------------------- 1 | package repositories 2 | 3 | import ( 4 | "context" 5 | "strings" 6 | 7 | "github.com/argoproj/argo-cd/v3/pkg/apiclient" 8 | "github.com/argoproj/argo-cd/v3/pkg/apiclient/repository" 9 | "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 10 | "github.com/argoproj/argo-cd/v3/util/io" 11 | "google.golang.org/grpc" 12 | ) 13 | 14 | const ( 15 | errorRepositoryNotFound = "code = NotFound desc = repo" 16 | errorPermissionDenied = "code = PermissionDenied desc = permission denied" 17 | ) 18 | 19 | // RepositoryServiceClient wraps the functions to connect to argocd repositories 20 | type RepositoryServiceClient interface { 21 | // Get returns a repository or its credentials 22 | Get(ctx context.Context, in *repository.RepoQuery, opts ...grpc.CallOption) (*v1alpha1.Repository, error) 23 | // ListRepositories gets a list of all configured repositories 24 | ListRepositories(ctx context.Context, in *repository.RepoQuery, opts ...grpc.CallOption) (*v1alpha1.RepositoryList, error) 25 | // Create creates a repo or a repo credential set 26 | CreateRepository(ctx context.Context, in *repository.RepoCreateRequest, opts ...grpc.CallOption) (*v1alpha1.Repository, error) 27 | // Update updates a repo or repo credential set 28 | UpdateRepository(ctx context.Context, in *repository.RepoUpdateRequest, opts ...grpc.CallOption) (*v1alpha1.Repository, error) 29 | // Delete deletes a repository from the configuration 30 | DeleteRepository(ctx context.Context, in *repository.RepoQuery, opts ...grpc.CallOption) (*repository.RepoResponse, error) 31 | } 32 | 33 | // NewRepositoryServiceClient creates a new API client from a set of config options, or fails fatally if the new client creation fails. 34 | func NewRepositoryServiceClient(clientOpts *apiclient.ClientOptions) (io.Closer, repository.RepositoryServiceClient) { 35 | conn, repoIf := apiclient.NewClientOrDie(clientOpts).NewRepoClientOrDie() 36 | return conn, repoIf 37 | } 38 | 39 | // IsErrorRepositoryNotFound helper function to test for errorRepositoryNotFound error. 40 | func IsErrorRepositoryNotFound(err error) bool { 41 | if err == nil { 42 | return false 43 | } 44 | return strings.Contains(err.Error(), errorRepositoryNotFound) 45 | } 46 | 47 | // IsErrorPermissionDenied helper function to test for errorPermissionDenied error. 48 | func IsErrorPermissionDenied(err error) bool { 49 | if err == nil { 50 | return false 51 | } 52 | return strings.Contains(err.Error(), errorPermissionDenied) 53 | } 54 | -------------------------------------------------------------------------------- /pkg/clients/namespace/argocd_namespace.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package namespace 18 | 19 | import ( 20 | "context" 21 | 22 | argocd "github.com/argoproj/argo-cd/v3/pkg/apiclient" 23 | "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 24 | "github.com/pkg/errors" 25 | "k8s.io/apimachinery/pkg/types" 26 | "sigs.k8s.io/controller-runtime/pkg/client" 27 | 28 | "github.com/crossplane-contrib/provider-argocd/apis/namespace/v1alpha1" 29 | clusterclients "github.com/crossplane-contrib/provider-argocd/pkg/clients/cluster" 30 | ) 31 | 32 | // GetConfigV2 constructs a Config that can be used to authenticate to argocd 33 | // API by the argocd Go client 34 | func GetConfig(ctx context.Context, c client.Client, mg resource.ModernManaged) (*argocd.ClientOptions, error) { 35 | switch { 36 | case mg.GetProviderConfigReference() != nil: 37 | return UseProviderConfig(ctx, c, mg) 38 | default: 39 | return nil, errors.New("providerConfigRef is not given") 40 | } 41 | } 42 | 43 | // UseProviderConfigV2 to produce a config that can be used to authenticate to argocd 44 | // API by the argocd Go client 45 | func UseProviderConfig(ctx context.Context, c client.Client, mg resource.ModernManaged) (*argocd.ClientOptions, error) { 46 | pc := &v1alpha1.ProviderConfig{} 47 | if err := c.Get(ctx, types.NamespacedName{Name: mg.GetProviderConfigReference().Name}, pc); err != nil { 48 | return nil, errors.Wrap(err, "cannot get referenced Provider") 49 | } 50 | 51 | t := resource.NewProviderConfigUsageTracker(c, &v1alpha1.ProviderConfigUsage{}) 52 | if err := t.Track(ctx, mg); err != nil { 53 | return nil, errors.Wrap(err, "cannot track ProviderConfig usage") 54 | } 55 | return clusterclients.GetClientOptions(ctx, c, &pc.Spec) 56 | } 57 | -------------------------------------------------------------------------------- /pkg/clients/namespace/converter/applications/zz_generated.copied.conversions.go: -------------------------------------------------------------------------------- 1 | // Code generated by copycode. DO NOT EDIT. 2 | 3 | package applications 4 | 5 | import ( 6 | "encoding/json" 7 | 8 | argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 9 | extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" 10 | "k8s.io/apimachinery/pkg/runtime" 11 | 12 | "github.com/crossplane-contrib/provider-argocd/apis/namespace/applications/v1alpha1" 13 | ) 14 | 15 | // Converter helps to convert ArgoCD types to api types of this provider and vise-versa 16 | // From & To shall both be defined for each type conversion, to prevent diverge from ArgoCD Types 17 | // goverter:converter 18 | // goverter:useZeroValueOnPointerInconsistency 19 | // goverter:ignoreUnexported 20 | // goverter:extend ExtV1JSONToRuntimeRawExtension 21 | // goverter:extend PV1alpha1HealthStatusToPV1alpha1HealthStatus 22 | // goverter:enum:unknown @ignore 23 | // goverter:struct:comment // +k8s:deepcopy-gen=false 24 | // goverter:output:file ./zz_generated.conversion.go 25 | // goverter:output:package github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace/converter/applications 26 | // +k8s:deepcopy-gen=false 27 | type Converter interface { 28 | 29 | // goverter:ignore ServerRef 30 | // goverter:ignore ServerSelector 31 | // goverter:ignore NameRef 32 | // goverter:ignore NameSelector 33 | FromArgoDestination(in argocdv1alpha1.ApplicationDestination) v1alpha1.ApplicationDestination 34 | 35 | ToArgoDestination(in v1alpha1.ApplicationDestination) argocdv1alpha1.ApplicationDestination 36 | 37 | ToArgoApplicationSpec(in *v1alpha1.ApplicationParameters) *argocdv1alpha1.ApplicationSpec 38 | 39 | FromArgoApplicationStatus(in *argocdv1alpha1.ApplicationStatus) *v1alpha1.ArgoApplicationStatus 40 | } 41 | 42 | // ExtV1JSONToRuntimeRawExtension converts an extv1.JSON into a 43 | // *runtime.RawExtension. 44 | func ExtV1JSONToRuntimeRawExtension(in extv1.JSON) *runtime.RawExtension { 45 | return &runtime.RawExtension{ 46 | Raw: in.Raw, 47 | } 48 | } 49 | 50 | func PV1alpha1HealthStatusToPV1alpha1HealthStatus(source *v1alpha1.HealthStatus) *argocdv1alpha1.HealthStatus { 51 | raw, _ := json.Marshal(source) //nolint:errchkjson // should never happen 52 | out := &argocdv1alpha1.HealthStatus{} 53 | _ = json.Unmarshal(raw, out) 54 | return out 55 | } 56 | -------------------------------------------------------------------------------- /pkg/clients/namespace/converter/applicationsets/zz_generated.copied.conversions.go: -------------------------------------------------------------------------------- 1 | // Code generated by copycode. DO NOT EDIT. 2 | 3 | package applicationsets 4 | 5 | import ( 6 | "encoding/json" 7 | 8 | argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 9 | extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" 10 | "k8s.io/apimachinery/pkg/runtime" 11 | 12 | "github.com/crossplane-contrib/provider-argocd/apis/namespace/applicationsets/v1alpha1" 13 | ) 14 | 15 | // Converter helps to convert ArgoCD types to api types of this provider and vise-versa 16 | // From & To shall both be defined for each type conversion, to prevent diverge from ArgoCD Types 17 | // goverter:converter 18 | // goverter:useZeroValueOnPointerInconsistency 19 | // goverter:ignoreUnexported 20 | // goverter:extend ExtV1JSONToRuntimeRawExtension 21 | // goverter:extend PV1alpha1HealthStatusToPV1alpha1HealthStatus 22 | // goverter:enum:unknown @ignore 23 | // goverter:struct:comment // +k8s:deepcopy-gen=false 24 | // goverter:output:file ./zz_generated.conversion.go 25 | // goverter:output:package github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace/converter/applicationsets 26 | // +k8s:deepcopy-gen=false 27 | type Converter interface { 28 | 29 | // goverter:ignore ServerRef 30 | // goverter:ignore ServerSelector 31 | // goverter:ignore NameRef 32 | // goverter:ignore NameSelector 33 | FromArgoDestination(in argocdv1alpha1.ApplicationDestination) v1alpha1.ApplicationDestination 34 | 35 | ToArgoDestination(in v1alpha1.ApplicationDestination) argocdv1alpha1.ApplicationDestination 36 | 37 | ToArgoApplicationSetSpec(in *v1alpha1.ApplicationSetParameters) *argocdv1alpha1.ApplicationSetSpec 38 | // goverter:ignore AppsetNamespace 39 | FromArgoApplicationSetSpec(in *argocdv1alpha1.ApplicationSetSpec) *v1alpha1.ApplicationSetParameters 40 | 41 | FromArgoApplicationSetStatus(in *argocdv1alpha1.ApplicationSetStatus) *v1alpha1.ArgoApplicationSetStatus 42 | ToArgoApplicationSetStatus(in *v1alpha1.ArgoApplicationSetStatus) *argocdv1alpha1.ApplicationSetStatus 43 | } 44 | 45 | // ExtV1JSONToRuntimeRawExtension converts an extv1.JSON into a 46 | // *runtime.RawExtension. 47 | func ExtV1JSONToRuntimeRawExtension(in extv1.JSON) *runtime.RawExtension { 48 | return &runtime.RawExtension{ 49 | Raw: in.Raw, 50 | } 51 | } 52 | 53 | func PV1alpha1HealthStatusToPV1alpha1HealthStatus(source *v1alpha1.HealthStatus) *argocdv1alpha1.HealthStatus { 54 | raw, _ := json.Marshal(source) //nolint:errchkjson // should never happen 55 | out := &argocdv1alpha1.HealthStatus{} 56 | _ = json.Unmarshal(raw, out) 57 | return out 58 | } 59 | -------------------------------------------------------------------------------- /pkg/clients/namespace/converter/generate.go: -------------------------------------------------------------------------------- 1 | package converter 2 | 3 | // Copy code generator interfaces from cluster to namespace 4 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copycode ../../cluster/converter/applications ./applications client,conversions 5 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g ./applications/zz_generated.copied.conversions.go 6 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g ./applications/zz_generated.copied.conversions.go 7 | 8 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copycode ../../cluster/converter/applicationsets ./applicationsets client,conversions 9 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g ./applicationsets/zz_generated.copied.conversions.go 10 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g ./applicationsets/zz_generated.copied.conversions.go 11 | 12 | // Generate conversion code 13 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/jmattheis/goverter/cmd/goverter gen -output-constraint !ignore_autogenerated ./... 14 | -------------------------------------------------------------------------------- /pkg/clients/namespace/pointer.go: -------------------------------------------------------------------------------- 1 | package namespace 2 | 3 | import "github.com/google/go-cmp/cmp" 4 | 5 | // LateInitializeStringPtr returns `from` if `in` is nil and `from` is non-empty, 6 | // in other cases it returns `in`. 7 | func LateInitializeStringPtr(in *string, from string) *string { 8 | if in == nil && from != "" { 9 | return &from 10 | } 11 | return in 12 | } 13 | 14 | // LateInitializeInt64Ptr returns `from` if `in` is nil and `from` is non-empty, 15 | // in other cases it returns `in`. 16 | func LateInitializeInt64Ptr(in *int64, from int64) *int64 { 17 | if in == nil && from != 0 { 18 | return &from 19 | } 20 | return in 21 | } 22 | 23 | // StringToPtr converts string to *string 24 | func StringToPtr(s string) *string { 25 | if s == "" { 26 | return nil 27 | } 28 | return &s 29 | } 30 | 31 | // StringValue converts a *string to string 32 | func StringValue(ptr *string) string { 33 | if ptr != nil { 34 | return *ptr 35 | } 36 | return "" 37 | } 38 | 39 | // Int64Value converts a *int64 to int64 40 | func Int64Value(ptr *int64) int64 { 41 | if ptr != nil { 42 | return *ptr 43 | } 44 | return 0 45 | } 46 | 47 | // BoolValue converts a *bool to bool 48 | func BoolValue(ptr *bool) bool { 49 | if ptr != nil { 50 | return *ptr 51 | } 52 | return false 53 | } 54 | 55 | // IsBoolEqualToBoolPtr compares a *bool with bool 56 | func IsBoolEqualToBoolPtr(bp *bool, b bool) bool { 57 | if bp != nil { 58 | if !cmp.Equal(*bp, b) { 59 | return false 60 | } 61 | } 62 | return true 63 | } 64 | 65 | // IsInt64EqualToInt64Ptr compares a *bool with bool 66 | func IsInt64EqualToInt64Ptr(ip *int64, i int64) bool { 67 | if ip != nil { 68 | if !cmp.Equal(*ip, i) { 69 | return false 70 | } 71 | } 72 | return true 73 | } 74 | -------------------------------------------------------------------------------- /pkg/controller/cluster/applications/comp.go: -------------------------------------------------------------------------------- 1 | package applications 2 | 3 | import ( 4 | "maps" 5 | "slices" 6 | 7 | argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 8 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 9 | "github.com/google/go-cmp/cmp" 10 | "github.com/google/go-cmp/cmp/cmpopts" 11 | 12 | "github.com/crossplane-contrib/provider-argocd/apis/cluster/applications/v1alpha1" 13 | applicationsconverter "github.com/crossplane-contrib/provider-argocd/pkg/clients/cluster/converter/applications" 14 | ) 15 | 16 | // IsApplicationUpToDate converts ApplicationParameters to its ArgoCD Counterpart and returns if they equal 17 | func IsApplicationUpToDate(cr *v1alpha1.ApplicationParameters, remote *argocdv1alpha1.Application) bool { 18 | converter := applicationsconverter.ConverterImpl{} 19 | cluster := converter.ToArgoApplicationSpec(cr) 20 | 21 | opts := []cmp.Option{ 22 | // explicitly ignore the unexported in this type instead of adding a generic allow on all type. 23 | // the unexported fields should not bother here, since we don't copy them or write them 24 | cmpopts.IgnoreUnexported(argocdv1alpha1.ApplicationDestination{}), 25 | } 26 | 27 | // Sort finalizer slices for comparison 28 | slices.Sort(cr.Finalizers) 29 | slices.Sort(remote.Finalizers) 30 | 31 | return cmp.Equal(*cluster, remote.Spec, opts...) && maps.Equal(cr.Annotations, remote.Annotations) && slices.Equal(cr.Finalizers, remote.Finalizers) 32 | } 33 | 34 | // getApplicationCondition evaluates the application status and returns appropriate Crossplane ready state 35 | func getApplicationCondition(status *v1alpha1.ArgoApplicationStatus) xpv1.Condition { 36 | if status == nil { 37 | return xpv1.Unavailable() 38 | } 39 | 40 | // If there's an operation in progress, check if it succeeded 41 | if status.OperationState != nil { 42 | if status.OperationState.Phase != "Succeeded" { 43 | return xpv1.Unavailable() 44 | } 45 | } 46 | 47 | healthOK := true 48 | if status.Health.Status != "" && status.Health.Status != "Healthy" { 49 | healthOK = false 50 | } 51 | 52 | if healthOK { 53 | return xpv1.Available() 54 | } 55 | 56 | return xpv1.Unavailable() 57 | } 58 | -------------------------------------------------------------------------------- /pkg/controller/cluster/applicationsets/comp.go: -------------------------------------------------------------------------------- 1 | package applicationsets 2 | 3 | import ( 4 | argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 5 | "github.com/google/go-cmp/cmp" 6 | "github.com/google/go-cmp/cmp/cmpopts" 7 | 8 | "github.com/crossplane-contrib/provider-argocd/apis/cluster/applicationsets/v1alpha1" 9 | "github.com/crossplane-contrib/provider-argocd/pkg/clients/cluster/converter/applicationsets" 10 | ) 11 | 12 | // IsApplicationSetUpToDate converts ApplicationParameters to its ArgoCD Counterpart and returns if they equal 13 | func IsApplicationSetUpToDate(cr *v1alpha1.ApplicationSetParameters, remote *argocdv1alpha1.ApplicationSet) bool { 14 | converter := applicationsets.ConverterImpl{} 15 | cluster := converter.ToArgoApplicationSetSpec(cr) 16 | 17 | opts := []cmp.Option{ 18 | // explicitly ignore the unexported in this type instead of adding a generic allow on all type. 19 | // the unexported fields should not bother here, since we don't copy them or write them 20 | cmpopts.IgnoreUnexported(argocdv1alpha1.ApplicationDestination{}), 21 | cmpopts.EquateEmpty(), 22 | } 23 | res := cmp.Equal(*cluster, remote.Spec, opts...) 24 | return res 25 | } 26 | -------------------------------------------------------------------------------- /pkg/controller/cluster/config/config.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package config 18 | 19 | import ( 20 | xpcontroller "github.com/crossplane/crossplane-runtime/v2/pkg/controller" 21 | "github.com/crossplane/crossplane-runtime/v2/pkg/event" 22 | "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/providerconfig" 23 | "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 24 | ctrl "sigs.k8s.io/controller-runtime" 25 | 26 | "github.com/crossplane-contrib/provider-argocd/apis/cluster/v1alpha1" 27 | ) 28 | 29 | // Setup adds a controller that reconciles ProviderConfigs by accounting for 30 | // their current usage. 31 | func Setup(mgr ctrl.Manager, o xpcontroller.Options) error { 32 | name := providerconfig.ControllerName(v1alpha1.ProviderConfigGroupKind) 33 | 34 | of := resource.ProviderConfigKinds{ 35 | Config: v1alpha1.ProviderConfigGroupVersionKind, 36 | Usage: v1alpha1.ProviderConfigUsageGroupVersionKind, 37 | UsageList: v1alpha1.ProviderConfigUsageListGroupVersionKind, 38 | } 39 | 40 | return ctrl.NewControllerManagedBy(mgr). 41 | Named(name). 42 | WithOptions(o.ForControllerRuntime()). 43 | For(&v1alpha1.ProviderConfig{}). 44 | Watches(&v1alpha1.ProviderConfigUsage{}, &resource.EnqueueRequestForProviderConfig{}). 45 | Complete(providerconfig.NewReconciler(mgr, of, 46 | providerconfig.WithLogger(o.Logger.WithValues("controller", name)), 47 | providerconfig.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) 48 | } 49 | -------------------------------------------------------------------------------- /pkg/controller/cluster/setup.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package cluster 18 | 19 | import ( 20 | xpcontroller "github.com/crossplane/crossplane-runtime/v2/pkg/controller" 21 | ctrl "sigs.k8s.io/controller-runtime" 22 | 23 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/cluster/applications" 24 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/cluster/applicationsets" 25 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/cluster/cluster" 26 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/cluster/config" 27 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/cluster/projects" 28 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/cluster/repositories" 29 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/cluster/tokens" 30 | ) 31 | 32 | // Setup creates all argocd API controllers with the supplied logger and adds 33 | // them to the supplied manager. 34 | func Setup(mgr ctrl.Manager, o xpcontroller.Options) error { 35 | for _, setup := range []func(ctrl.Manager, xpcontroller.Options) error{ 36 | config.Setup, 37 | repositories.Setup, 38 | projects.Setup, 39 | cluster.Setup, 40 | applications.Setup, 41 | applicationsets.Setup, 42 | tokens.Setup, 43 | } { 44 | if err := setup(mgr, o); err != nil { 45 | return err 46 | } 47 | } 48 | return nil 49 | } 50 | -------------------------------------------------------------------------------- /pkg/controller/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package controller 18 | -------------------------------------------------------------------------------- /pkg/controller/namespace/applications/generate.go: -------------------------------------------------------------------------------- 1 | package applications 2 | 3 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copycode --tests ../../cluster/applications . 4 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller.go 5 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller_test.go 6 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.comp.go 7 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.comp_test.go 8 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller.go 9 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller_test.go 10 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.comp.go 11 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.comp_test.go 12 | -------------------------------------------------------------------------------- /pkg/controller/namespace/applications/zz_generated.copied.comp.go: -------------------------------------------------------------------------------- 1 | // Code generated by copycode. DO NOT EDIT. 2 | 3 | package applications 4 | 5 | import ( 6 | "maps" 7 | "slices" 8 | 9 | argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 10 | xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1" 11 | "github.com/google/go-cmp/cmp" 12 | "github.com/google/go-cmp/cmp/cmpopts" 13 | 14 | "github.com/crossplane-contrib/provider-argocd/apis/namespace/applications/v1alpha1" 15 | applicationsconverter "github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace/converter/applications" 16 | ) 17 | 18 | // IsApplicationUpToDate converts ApplicationParameters to its ArgoCD Counterpart and returns if they equal 19 | func IsApplicationUpToDate(cr *v1alpha1.ApplicationParameters, remote *argocdv1alpha1.Application) bool { 20 | converter := applicationsconverter.ConverterImpl{} 21 | cluster := converter.ToArgoApplicationSpec(cr) 22 | 23 | opts := []cmp.Option{ 24 | // explicitly ignore the unexported in this type instead of adding a generic allow on all type. 25 | // the unexported fields should not bother here, since we don't copy them or write them 26 | cmpopts.IgnoreUnexported(argocdv1alpha1.ApplicationDestination{}), 27 | } 28 | 29 | // Sort finalizer slices for comparison 30 | slices.Sort(cr.Finalizers) 31 | slices.Sort(remote.Finalizers) 32 | 33 | return cmp.Equal(*cluster, remote.Spec, opts...) && maps.Equal(cr.Annotations, remote.Annotations) && slices.Equal(cr.Finalizers, remote.Finalizers) 34 | } 35 | 36 | // getApplicationCondition evaluates the application status and returns appropriate Crossplane ready state 37 | func getApplicationCondition(status *v1alpha1.ArgoApplicationStatus) xpv1.Condition { 38 | if status == nil { 39 | return xpv1.Unavailable() 40 | } 41 | 42 | // If there's an operation in progress, check if it succeeded 43 | if status.OperationState != nil { 44 | if status.OperationState.Phase != "Succeeded" { 45 | return xpv1.Unavailable() 46 | } 47 | } 48 | 49 | healthOK := true 50 | if status.Health.Status != "" && status.Health.Status != "Healthy" { 51 | healthOK = false 52 | } 53 | 54 | if healthOK { 55 | return xpv1.Available() 56 | } 57 | 58 | return xpv1.Unavailable() 59 | } 60 | -------------------------------------------------------------------------------- /pkg/controller/namespace/applicationsets/generate.go: -------------------------------------------------------------------------------- 1 | package applicationsets 2 | 3 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copycode --tests ../../cluster/applicationsets . 4 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller.go 5 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller_test.go 6 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.comp.go 7 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller.go 8 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller_test.go 9 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.comp.go 10 | -------------------------------------------------------------------------------- /pkg/controller/namespace/applicationsets/zz_generated.copied.comp.go: -------------------------------------------------------------------------------- 1 | // Code generated by copycode. DO NOT EDIT. 2 | 3 | package applicationsets 4 | 5 | import ( 6 | argocdv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" 7 | "github.com/google/go-cmp/cmp" 8 | "github.com/google/go-cmp/cmp/cmpopts" 9 | 10 | "github.com/crossplane-contrib/provider-argocd/apis/namespace/applicationsets/v1alpha1" 11 | "github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace/converter/applicationsets" 12 | ) 13 | 14 | // IsApplicationSetUpToDate converts ApplicationParameters to its ArgoCD Counterpart and returns if they equal 15 | func IsApplicationSetUpToDate(cr *v1alpha1.ApplicationSetParameters, remote *argocdv1alpha1.ApplicationSet) bool { 16 | converter := applicationsets.ConverterImpl{} 17 | cluster := converter.ToArgoApplicationSetSpec(cr) 18 | 19 | opts := []cmp.Option{ 20 | // explicitly ignore the unexported in this type instead of adding a generic allow on all type. 21 | // the unexported fields should not bother here, since we don't copy them or write them 22 | cmpopts.IgnoreUnexported(argocdv1alpha1.ApplicationDestination{}), 23 | cmpopts.EquateEmpty(), 24 | } 25 | res := cmp.Equal(*cluster, remote.Spec, opts...) 26 | return res 27 | } 28 | -------------------------------------------------------------------------------- /pkg/controller/namespace/cluster/generate.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copycode --tests ../../cluster/cluster . 4 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller.go 5 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller_test.go 6 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller.go 7 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller_test.go 8 | -------------------------------------------------------------------------------- /pkg/controller/namespace/config/config.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package config 18 | 19 | import ( 20 | xpcontroller "github.com/crossplane/crossplane-runtime/v2/pkg/controller" 21 | "github.com/crossplane/crossplane-runtime/v2/pkg/event" 22 | "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/providerconfig" 23 | "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 24 | ctrl "sigs.k8s.io/controller-runtime" 25 | 26 | "github.com/crossplane-contrib/provider-argocd/apis/namespace/v1alpha1" 27 | ) 28 | 29 | // Setup adds a controller that reconciles ProviderConfigs by accounting for 30 | // their current usage. 31 | func Setup(mgr ctrl.Manager, o xpcontroller.Options) error { 32 | name := providerconfig.ControllerName(v1alpha1.ProviderConfigGroupKind) 33 | 34 | of := resource.ProviderConfigKinds{ 35 | Config: v1alpha1.ProviderConfigGroupVersionKind, 36 | Usage: v1alpha1.ProviderConfigUsageGroupVersionKind, 37 | UsageList: v1alpha1.ProviderConfigUsageListGroupVersionKind, 38 | } 39 | 40 | return ctrl.NewControllerManagedBy(mgr). 41 | Named(name). 42 | WithOptions(o.ForControllerRuntime()). 43 | For(&v1alpha1.ProviderConfig{}). 44 | Watches(&v1alpha1.ProviderConfigUsage{}, &resource.EnqueueRequestForProviderConfig{}). 45 | Complete(providerconfig.NewReconciler(mgr, of, 46 | providerconfig.WithLogger(o.Logger.WithValues("controller", name)), 47 | providerconfig.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) 48 | } 49 | -------------------------------------------------------------------------------- /pkg/controller/namespace/projects/generate.go: -------------------------------------------------------------------------------- 1 | package projects 2 | 3 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copycode --tests ../../cluster/projects . 4 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller.go 5 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller_test.go 6 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller.go 7 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller_test.go 8 | -------------------------------------------------------------------------------- /pkg/controller/namespace/repositories/generate.go: -------------------------------------------------------------------------------- 1 | package repositories 2 | 3 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copycode --tests ../../cluster/repositories . 4 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller.go 5 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller_test.go 6 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller.go 7 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller_test.go 8 | -------------------------------------------------------------------------------- /pkg/controller/namespace/setup.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package namespace 18 | 19 | import ( 20 | xpcontroller "github.com/crossplane/crossplane-runtime/v2/pkg/controller" 21 | ctrl "sigs.k8s.io/controller-runtime" 22 | 23 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/namespace/applications" 24 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/namespace/applicationsets" 25 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/namespace/cluster" 26 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/namespace/config" 27 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/namespace/projects" 28 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/namespace/repositories" 29 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/namespace/tokens" 30 | ) 31 | 32 | // Setup creates all argocd API controllers with the supplied logger and adds 33 | // them to the supplied manager. 34 | func Setup(mgr ctrl.Manager, o xpcontroller.Options) error { 35 | for _, setup := range []func(ctrl.Manager, xpcontroller.Options) error{ 36 | config.Setup, 37 | repositories.Setup, 38 | projects.Setup, 39 | cluster.Setup, 40 | applications.Setup, 41 | applicationsets.Setup, 42 | tokens.Setup, 43 | } { 44 | if err := setup(mgr, o); err != nil { 45 | return err 46 | } 47 | } 48 | return nil 49 | } 50 | -------------------------------------------------------------------------------- /pkg/controller/namespace/tokens/generate.go: -------------------------------------------------------------------------------- 1 | package tokens 2 | 3 | //go:generate go run -modfile ../../../../tools/go.mod -tags generate github.com/mistermx/copystruct/cmd/copycode --tests ../../cluster/tokens . 4 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller.go 5 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/apis/cluster|github.com/crossplane-contrib/provider-argocd/apis/namespace|g zz_generated.copied.controller_test.go 6 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller.go 7 | //go:generate sed -i s|github\.com/crossplane-contrib/provider-argocd/pkg/clients/cluster|github.com/crossplane-contrib/provider-argocd/pkg/clients/namespace|g zz_generated.copied.controller_test.go 8 | //go:generate sed -i s|resource.ConnectionSecretFor|resource.LocalConnectionSecretFor|g zz_generated.copied.controller.go 9 | -------------------------------------------------------------------------------- /pkg/controller/setup.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package controller 18 | 19 | import ( 20 | xpcontroller "github.com/crossplane/crossplane-runtime/v2/pkg/controller" 21 | ctrl "sigs.k8s.io/controller-runtime" 22 | 23 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/cluster" 24 | "github.com/crossplane-contrib/provider-argocd/pkg/controller/namespace" 25 | ) 26 | 27 | // Setup creates all argocd API controllers with the supplied logger and adds 28 | // them to the supplied manager. 29 | func Setup(mgr ctrl.Manager, o xpcontroller.Options) error { 30 | for _, setup := range []func(ctrl.Manager, xpcontroller.Options) error{ 31 | cluster.Setup, 32 | namespace.Setup, 33 | } { 34 | if err := setup(mgr, o); err != nil { 35 | return err 36 | } 37 | } 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /pkg/features/features.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 The Crossplane Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package features 18 | 19 | import ( 20 | xpcontroller "github.com/crossplane/crossplane-runtime/v2/pkg/controller" 21 | "github.com/crossplane/crossplane-runtime/v2/pkg/feature" 22 | "github.com/crossplane/crossplane-runtime/v2/pkg/reconciler/managed" 23 | "github.com/crossplane/crossplane-runtime/v2/pkg/resource" 24 | "github.com/crossplane/crossplane-runtime/v2/pkg/statemetrics" 25 | ctrl "sigs.k8s.io/controller-runtime" 26 | ) 27 | 28 | func Opts(o xpcontroller.Options) []managed.ReconcilerOption { 29 | opts := []managed.ReconcilerOption{} 30 | 31 | if o.Features.Enabled(feature.EnableAlphaChangeLogs) { 32 | opts = append(opts, managed.WithChangeLogger(o.ChangeLogOptions.ChangeLogger)) 33 | } 34 | 35 | if o.Features.Enabled(feature.EnableBetaManagementPolicies) { 36 | opts = append(opts, managed.WithManagementPolicies()) 37 | } 38 | 39 | return opts 40 | } 41 | 42 | func AddMRMetrics(mgr ctrl.Manager, o xpcontroller.Options, object resource.ManagedList) error { 43 | return mgr.Add(statemetrics.NewMRStateRecorder(mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, object, o.MetricOptions.PollStateMetricInterval)) 44 | } 45 | -------------------------------------------------------------------------------- /pkg/version/version.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Crossplane Authors. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | 14 | // Package version contains the version of this repo 15 | package version 16 | 17 | // Version will be overridden with the current version at build time using the -X linker flag 18 | var Version = "0.0.0" 19 | -------------------------------------------------------------------------------- /tools/generate.go: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | /* 5 | Copyright 2019 The Crossplane Authors. 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | // Package tools keeps tracks of the code generator dependencies that are 21 | // only needed during development. 22 | package tools 23 | 24 | import ( 25 | _ "github.com/crossplane/crossplane-tools/cmd/angryjet" //nolint:typecheck 26 | _ "github.com/jmattheis/goverter/cmd/goverter" //nolint:typecheck 27 | _ "github.com/mistermx/copystruct/cmd/copystruct" //nolint:typecheck 28 | _ "sigs.k8s.io/controller-tools/cmd/controller-gen" //nolint:typecheck 29 | 30 | // Workaround to vendor mockgen (https://github.com/golang/mock/issues/415#issuecomment-602547154) 31 | _ "github.com/golang/mock/mockgen" //nolint:typecheck 32 | ) 33 | -------------------------------------------------------------------------------- /tools/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/crossplane-contrib/provider-argocd/tools 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/crossplane/crossplane-tools v0.0.0-20250731192036-00d407d8b7ec 7 | github.com/golang/mock v1.6.0 8 | github.com/jmattheis/goverter v1.9.2 9 | github.com/mistermx/copystruct v1.1.1 10 | sigs.k8s.io/controller-tools v0.18.0 11 | ) 12 | 13 | require ( 14 | github.com/alecthomas/kingpin/v2 v2.4.0 // indirect 15 | github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect 16 | github.com/dave/jennifer v1.7.1 // indirect 17 | github.com/fatih/color v1.18.0 // indirect 18 | github.com/fxamacker/cbor/v2 v2.7.0 // indirect 19 | github.com/go-logr/logr v1.4.2 // indirect 20 | github.com/go-openapi/jsonpointer v0.21.0 // indirect 21 | github.com/go-openapi/jsonreference v0.20.2 // indirect 22 | github.com/go-openapi/swag v0.23.0 // indirect 23 | github.com/gobuffalo/flect v1.0.3 // indirect 24 | github.com/gogo/protobuf v1.3.2 // indirect 25 | github.com/google/gnostic-models v0.6.9 // indirect 26 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 27 | github.com/josharian/intern v1.0.0 // indirect 28 | github.com/json-iterator/go v1.1.12 // indirect 29 | github.com/mailru/easyjson v0.7.7 // indirect 30 | github.com/mattn/go-colorable v0.1.13 // indirect 31 | github.com/mattn/go-isatty v0.0.20 // indirect 32 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 33 | github.com/modern-go/reflect2 v1.0.2 // indirect 34 | github.com/pkg/errors v0.9.1 // indirect 35 | github.com/spf13/cobra v1.9.1 // indirect 36 | github.com/spf13/pflag v1.0.6 // indirect 37 | github.com/x448/float16 v0.8.4 // indirect 38 | github.com/xhit/go-str2duration/v2 v2.1.0 // indirect 39 | go.uber.org/mock v0.6.0 // indirect 40 | golang.org/x/mod v0.28.0 // indirect 41 | golang.org/x/net v0.44.0 // indirect 42 | golang.org/x/sync v0.17.0 // indirect 43 | golang.org/x/sys v0.36.0 // indirect 44 | golang.org/x/text v0.29.0 // indirect 45 | golang.org/x/tools v0.37.0 // indirect 46 | golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated // indirect 47 | google.golang.org/protobuf v1.36.5 // indirect 48 | gopkg.in/inf.v0 v0.9.1 // indirect 49 | gopkg.in/yaml.v2 v2.4.0 // indirect 50 | gopkg.in/yaml.v3 v3.0.1 // indirect 51 | k8s.io/api v0.33.0 // indirect 52 | k8s.io/apiextensions-apiserver v0.33.0 // indirect 53 | k8s.io/apimachinery v0.33.0 // indirect 54 | k8s.io/code-generator v0.33.0 // indirect 55 | k8s.io/gengo/v2 v2.0.0-20250207200755-1244d31929d7 // indirect 56 | k8s.io/klog/v2 v2.130.1 // indirect 57 | k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect 58 | k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e // indirect 59 | sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect 60 | sigs.k8s.io/randfill v1.0.0 // indirect 61 | sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect 62 | sigs.k8s.io/yaml v1.4.0 // indirect 63 | ) 64 | --------------------------------------------------------------------------------