opencdk8scdk8sargocdresources

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

cdk8s-argocd-resources

Has the ability to synth ArgoCD Application, and AppProject manifests. See example.

Overview

example
import { Construct } from 'constructs';
import { App, Chart, ChartProps } from 'cdk8s';
import * as argo from '@opencdk8s/cdk8s-argocd-resources';

export class MyChart extends Chart {
  constructor(scope: Construct, id: string, props: ChartProps = { }) {
    super(scope, id, props);

    new argo.ArgoCdApplication(this, 'DemoApp', {
      metadata: {
        name: 'demo',
        namespace: 'argocd',
      },
      spec: {
        project: 'default',
        source: {
          repoURL: 'example-git-repo',
          path: 'examplepath',
          targetRevision: 'HEAD',
        },
        destination: {
          server: 'https://kubernetes.default.svc'
        },
        syncPolicy: {
          syncOptions: [
            'ApplyOutOfSyncOnly=true'
          ]
        }
      },
    });

    new argo.ArgoCdProject(this, 'DemoProject', {
      metadata: {
        name: 'demo',
        namespace: 'argocd',
      },
      spec: {
        description: 'demo project',
        sourceRepos: [
          '*'
        ],
        destination: [{
          namespace: 'default',
          server: 'https://kubernetes.default.svc'
        }]
      }

    });

    // define resources here

  }
}

const app = new App();
new MyChart(app, 'asd');
app.synth();
demo.k8s.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: demo
  namespace: argocd
spec:
  destination:
    server: https://kubernetes.default.svc
  project: default
  source:
    path: examplepath
    repoURL: example-git-repo
    targetRevision: HEAD
  syncPolicy:
    syncOptions:
      - ApplyOutOfSyncOnly=true
---
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
  name: demo
  namespace: argocd
spec:
  description: demo project
  destination:
    - namespace: default
      server: https://kubernetes.default.svc
  sourceRepos:
    - "*"

Installation

TypeScript

Use yarn or npm to install.

$ npm install @opencdk8s/cdk8s-argocd-resources
$ yarn add @opencdk8s/cdk8s-argocd-resources
Python
$ pip install cdk8s-argocd-resources

Contribution

  1. Fork (link)

  2. Bootstrap the repo:

    npx projen   # generates package.json
    yarn install # installs dependencies
    
  3. Development scripts:

    Command Description
    yarn compile Compiles typescript => javascript
    yarn watch Watch & compile
    yarn test Run unit test & linter through jest
    yarn test -u Update jest snapshots
    yarn run package Creates a dist with packages for all languages.
    yarn build Compile + test + package
    yarn bump Bump version (with changelog) based on [conventional commits]
    yarn release Bump + push to master
  4. Create a feature branch

  5. Commit your changes

  6. Rebase your local changes against the master branch

  7. Create a new Pull Request (use conventional commits for the title please)

Licence

Apache License, Version 2.0

Author

Hunter-Thompson

Documentation

Overview

@opencdk8s/cdk8s-argocd-resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgoCdApplication_GVK

func ArgoCdApplication_GVK() *cdk8s.GroupVersionKind

func ArgoCdApplication_IsConstruct

func ArgoCdApplication_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead

func ArgoCdApplication_Manifest

func ArgoCdApplication_Manifest(props *ArgoCdApplicationProps) interface{}

Renders a Kubernetes manifest for an ingress object. https://github.com/kubernetes-sigs/aws-load-balancer-controller.

This can be used to inline resource manifests inside other objects (e.g. as templates). Experimental.

func ArgoCdApplication_Of

func ArgoCdApplication_Of(c constructs.IConstruct) cdk8s.ApiObject

Returns the `ApiObject` named `Resource` which is a child of the given construct.

If `c` is an `ApiObject`, it is returned directly. Throws an exception if the construct does not have a child named `Default` _or_ if this child is not an `ApiObject`. Experimental.

func ArgoCdProject_GVK

func ArgoCdProject_GVK() *cdk8s.GroupVersionKind

func ArgoCdProject_IsConstruct

func ArgoCdProject_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead

func ArgoCdProject_Manifest

func ArgoCdProject_Manifest(props *ArgoCdProjectProps) interface{}

Renders a Kubernetes manifest for an ingress object. https://github.com/kubernetes-sigs/aws-load-balancer-controller.

This can be used to inline resource manifests inside other objects (e.g. as templates). Experimental.

func ArgoCdProject_Of

func ArgoCdProject_Of(c constructs.IConstruct) cdk8s.ApiObject

Returns the `ApiObject` named `Resource` which is a child of the given construct.

If `c` is an `ApiObject`, it is returned directly. Throws an exception if the construct does not have a child named `Default` _or_ if this child is not an `ApiObject`. Experimental.

func NewArgoCdApplication_Override

func NewArgoCdApplication_Override(a ArgoCdApplication, scope constructs.Construct, id *string, props *ArgoCdApplicationProps)

Defines an "extentions" API object for AWS Load Balancer Controller - https://github.com/kubernetes-sigs/aws-load-balancer-controller. Experimental.

func NewArgoCdProject_Override

func NewArgoCdProject_Override(a ArgoCdProject, scope constructs.Construct, id *string, props *ArgoCdProjectProps)

Defines an "extentions" API object for AWS Load Balancer Controller - https://github.com/kubernetes-sigs/aws-load-balancer-controller. Experimental.

Types

type ApplicationDestination

type ApplicationDestination struct {
	// Experimental.
	Name *string `json:"name"`
	// Experimental.
	Namespace *string `json:"namespace"`
	// Experimental.
	Server *string `json:"server"`
}

Experimental.

type ApplicationDirectory

type ApplicationDirectory struct {
	// Experimental.
	Recurse *bool `json:"recurse"`
}

Experimental.

type ApplicationPlugin

type ApplicationPlugin struct {
	// Experimental.
	Env *[]*k8s.EnvVar `json:"env"`
	// Experimental.
	Name *string `json:"name"`
}

Experimental.

type ApplicationSource

type ApplicationSource struct {
	// Experimental.
	Chart *string `json:"chart"`
	// Experimental.
	Directory *ApplicationDirectory `json:"directory"`
	// Experimental.
	Helm *HelmOptions `json:"helm"`
	// Experimental.
	Path *string `json:"path"`
	// Experimental.
	Plugin *ApplicationPlugin `json:"plugin"`
	// Experimental.
	Ref *string `json:"ref"`
	// Experimental.
	RepoURL *string `json:"repoURL"`
	// Experimental.
	TargetRevision *string `json:"targetRevision"`
}

Experimental.

type ApplicationSyncPolicy

type ApplicationSyncPolicy struct {
	// Experimental.
	Automated *SyncPolicyAutomated `json:"automated"`
	// Experimental.
	Retry *SyncRetry `json:"retry"`
	// Experimental.
	SyncOptions *[]*string `json:"syncOptions"`
}

Experimental.

type ArgoCdApplication

type ArgoCdApplication interface {
	cdk8s.ApiObject
	ApiGroup() *string
	ApiVersion() *string
	Chart() cdk8s.Chart
	Kind() *string
	Metadata() cdk8s.ApiObjectMetadataDefinition
	Name() *string
	Node() constructs.Node
	AddDependency(dependencies ...constructs.IConstruct)
	AddJsonPatch(ops ...cdk8s.JsonPatch)
	ToJson() interface{}
	ToString() *string
}

Experimental.

func NewArgoCdApplication

func NewArgoCdApplication(scope constructs.Construct, id *string, props *ArgoCdApplicationProps) ArgoCdApplication

Defines an "extentions" API object for AWS Load Balancer Controller - https://github.com/kubernetes-sigs/aws-load-balancer-controller. Experimental.

type ArgoCdApplicationProps

type ArgoCdApplicationProps struct {
	// Experimental.
	Metadata *k8s.ObjectMeta `json:"metadata"`
	// Experimental.
	Spec *ArgoCdApplicationSpec `json:"spec"`
}

Experimental.

type ArgoCdApplicationSpec

type ArgoCdApplicationSpec struct {
	// Experimental.
	Destination *ApplicationDestination `json:"destination"`
	// Experimental.
	IgnoreDifferences *[]*ResourceIgnoreDifferences `json:"ignoreDifferences"`
	// Experimental.
	Project *string `json:"project"`
	// Experimental.
	Source *ApplicationSource `json:"source"`
	// Experimental.
	Sources *[]*ApplicationSource `json:"sources"`
	// Experimental.
	SyncPolicy *ApplicationSyncPolicy `json:"syncPolicy"`
}

Experimental.

type ArgoCdProject

type ArgoCdProject interface {
	cdk8s.ApiObject
	ApiGroup() *string
	ApiVersion() *string
	Chart() cdk8s.Chart
	Kind() *string
	Metadata() cdk8s.ApiObjectMetadataDefinition
	Name() *string
	Node() constructs.Node
	AddDependency(dependencies ...constructs.IConstruct)
	AddJsonPatch(ops ...cdk8s.JsonPatch)
	ToJson() interface{}
	ToString() *string
}

Experimental.

func NewArgoCdProject

func NewArgoCdProject(scope constructs.Construct, id *string, props *ArgoCdProjectProps) ArgoCdProject

Defines an "extentions" API object for AWS Load Balancer Controller - https://github.com/kubernetes-sigs/aws-load-balancer-controller. Experimental.

type ArgoCdProjectProps

type ArgoCdProjectProps struct {
	// Experimental.
	Metadata *k8s.ObjectMeta `json:"metadata"`
	// Experimental.
	Spec *ArgoCdProjectSpec `json:"spec"`
}

Experimental.

type ArgoCdProjectSpec

type ArgoCdProjectSpec struct {
	// Experimental.
	ClusterResourceWhiteList *[]*ResourceRef `json:"clusterResourceWhiteList"`
	// Experimental.
	Description *string `json:"description"`
	// Experimental.
	Destination *[]*ApplicationDestination `json:"destination"`
	// Experimental.
	NamespaceResourceBlacklist *[]*ResourceRef `json:"namespaceResourceBlacklist"`
	// Experimental.
	NamespaceResourceWhitelist *[]*ResourceRef `json:"namespaceResourceWhitelist"`
	// Experimental.
	Roles *[]*ProjectRoles `json:"roles"`
	// Experimental.
	SourceRepos *[]*string `json:"sourceRepos"`
}

Experimental.

type HelmOptions added in v0.0.7

type HelmOptions struct {
	// Experimental.
	Force *bool `json:"force"`
	// Experimental.
	HelmOptions *[]*string `json:"helmOptions"`
	// Experimental.
	HelmVersion *string `json:"helmVersion"`
	// Experimental.
	Install *bool `json:"install"`
	// Experimental.
	Lint *bool `json:"lint"`
	// Experimental.
	ReleaseName *string `json:"releaseName"`
	// Experimental.
	Repo *string `json:"repo"`
	// Experimental.
	TargetRevision *string `json:"targetRevision"`
	// Experimental.
	Timeout *string `json:"timeout"`
	// Experimental.
	Upgrade *bool `json:"upgrade"`
	// Experimental.
	ValueFiles *[]*string `json:"valueFiles"`
	// Experimental.
	Values *map[string]*string `json:"values"`
	// Experimental.
	ValuesFrom *[]*HelmValuesFromSource `json:"valuesFrom"`
	// Experimental.
	Verify *bool `json:"verify"`
	// Experimental.
	Version *string `json:"version"`
	// Experimental.
	Wait *bool `json:"wait"`
}

Experimental.

type HelmValuesFromSource added in v0.0.7

type HelmValuesFromSource struct {
	// Experimental.
	Group *string `json:"group"`
	// Experimental.
	JqPathExpressions *[]*string `json:"jqPathExpressions"`
	// Experimental.
	JsonPointers *[]*string `json:"jsonPointers"`
	// Experimental.
	Kind *string `json:"kind"`
	// Experimental.
	Name *string `json:"name"`
	// Experimental.
	Namespace *string `json:"namespace"`
	// Experimental.
	Values *map[string]*string `json:"values"`
	// Experimental.
	Version *string `json:"version"`
}

Experimental.

type ProjectRoles

type ProjectRoles struct {
	// Experimental.
	Description *string `json:"description"`
	// Experimental.
	Groups *[]*string `json:"groups"`
	// Experimental.
	Name *string `json:"name"`
	// Experimental.
	Policies *[]*string `json:"policies"`
}

Experimental.

type ResourceIgnoreDifferences added in v0.0.6

type ResourceIgnoreDifferences struct {
	// Experimental.
	Group *string `json:"group"`
	// Experimental.
	JqPathExpressions *[]*string `json:"jqPathExpressions"`
	// Experimental.
	JsonPointers *[]*string `json:"jsonPointers"`
	// Experimental.
	Kind *string `json:"kind"`
	// Experimental.
	Name *string `json:"name"`
	// Experimental.
	Namespace *string `json:"namespace"`
	// Experimental.
	Server *string `json:"server"`
}

Experimental.

type ResourceRef

type ResourceRef struct {
	// Experimental.
	Group *string `json:"group"`
	// Experimental.
	Kind *string `json:"kind"`
}

Experimental.

type RetryBackoff

type RetryBackoff struct {
	// Experimental.
	Duration *string `json:"duration"`
	// Experimental.
	Factor *float64 `json:"factor"`
	// Experimental.
	MaxDuration *string `json:"maxDuration"`
}

Experimental.

type SyncPolicyAutomated

type SyncPolicyAutomated struct {
	// Experimental.
	AllowEmpty *bool `json:"allowEmpty"`
	// Experimental.
	Prune *bool `json:"prune"`
	// Experimental.
	SelfHeal *bool `json:"selfHeal"`
}

Experimental.

type SyncRetry

type SyncRetry struct {
	// Experimental.
	Backoff *RetryBackoff `json:"backoff"`
	// Experimental.
	Limit *float64 `json:"limit"`
}

Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
k8s

Jump to

Keyboard shortcuts

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