Last modified November 27, 2024

'kubectl gs gitops add organization' command reference

This command adds a new Organization to the GitOps repository.

Prerequisites

Your GitOps repository should provide the following structural layers:

Description

The structure created by this command is presented below. Note, the initial layers are flattened for brevity.

management-clusters/MC_NAME/organizations
└── ORG_NAME
    ├── ORG_NAME.yaml
    └── workload-clusters
        └── kustomization.yaml

Usage

Basic command syntax: kubectl gs gitops add organization FLAGS.

Flags

  • --management-cluster – management cluster the organization belongs to (required)
  • --name – organization name (required)

The following flags are supported by all gitops subcommands:

  • --dry-run – Print files and directories instead of creating them.
  • --local-path – Path to the repository root folder (default “.”).

Examples

kubectl gs gitops add organization \
  --local-path /tmp/gitops-demo \
  --name demoorg \
  --management-cluster demomc \
  --dry-run

Output:

## CREATE##
/tmp/gitops-demo/management-clusters/demomc/organizations/demoorg
/tmp/gitops-demo/management-clusters/demomc/organizations/demoorg/demoorg.yaml
apiVersion: security.giantswarm.io/v1alpha1
kind: Organization
metadata:
  name: demoorg
spec: {}

/tmp/gitops-demo/management-clusters/demomc/organizations/demoorg/workload-clusters
/tmp/gitops-demo/management-clusters/demomc/organizations/demoorg/workload-clusters/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources: []

Remove the --dry-run flag and re-run it to apply the changes.