Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add aws-controllers-k8s/organizations-controller #181

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ Files: crd-catalog/aws-controllers-k8s/opensearchservice-controller/*
Copyright: The aws-controllers-k8s/opensearchservice-controller Authors
License: Apache-2.0

Files: crd-catalog/aws-controllers-k8s/organizations-controller/*
Copyright: The aws-controllers-k8s/organizations-controller Authors
License: Apache-2.0

Files: crd-catalog/aws-controllers-k8s/pipes-controller/*
Copyright: The aws-controllers-k8s/pipes-controller Authors
License: Apache-2.0
Expand Down
7 changes: 7 additions & 0 deletions code-generator/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,13 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[
"https://github.com/aws-controllers-k8s/opensearchservice-controller/blob/main/config/crd/bases/opensearchservice.services.k8s.aws_domains.yaml",
],
},
UpstreamSource {
project_name: "aws-controllers-k8s/organizations-controller",
license: APACHE_V2,
urls: &[
"https://github.com/aws-controllers-k8s/organizations-controller/blob/main/config/crd/bases/organizations.services.k8s.aws_organizationalunits.yaml",
],
},
UpstreamSource {
project_name: "aws-controllers-k8s/pipes-controller",
license: APACHE_V2,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
apiVersion: "apiextensions.k8s.io/v1"
kind: "CustomResourceDefinition"
metadata:
annotations:
controller-gen.kubebuilder.io/version: "v0.14.0"
name: "organizationalunits.organizations.services.k8s.aws"
spec:
group: "organizations.services.k8s.aws"
names:
kind: "OrganizationalUnit"
listKind: "OrganizationalUnitList"
plural: "organizationalunits"
singular: "organizationalunit"
scope: "Namespaced"
versions:
- name: "v1alpha1"
schema:
openAPIV3Schema:
description: "OrganizationalUnit is the Schema for the OrganizationalUnits API"
properties:
apiVersion:
description: "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources"
type: "string"
kind:
description: "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
type: "string"
metadata:
type: "object"
spec:
description: "OrganizationalUnitSpec defines the desired state of OrganizationalUnit.\n\n\nContains details about an organizational unit (OU). An OU is a container\nof Amazon Web Services accounts within a root of an organization. Policies\nthat are attached to an OU apply to all accounts contained in that OU and\nin any child OUs."
properties:
name:
description: "The friendly name to assign to the new OU."
type: "string"
parentID:
description: "The unique identifier (ID) of the parent root or OU that you want to create\nthe new OU in.\n\n\nThe regex pattern (http://wikipedia.org/wiki/regex) for a parent ID string\nrequires one of the following:\n\n\n * Root - A string that begins with \"r-\" followed by from 4 to 32 lowercase\n letters or digits.\n\n\n * Organizational unit (OU) - A string that begins with \"ou-\" followed\n by from 4 to 32 lowercase letters or digits (the ID of the root that the\n OU is in). This string is followed by a second \"-\" dash and from 8 to\n 32 additional lowercase letters or digits."
type: "string"
tags:
description: "A list of tags that you want to attach to the newly created OU. For each\ntag in the list, you must specify both a tag key and a value. You can set\nthe value to an empty string, but you can't set it to null. For more information\nabout tagging, see Tagging Organizations resources (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_tagging.html)\nin the Organizations User Guide.\n\n\nIf any one of the tags is invalid or if you exceed the allowed number of\ntags for an OU, then the entire request fails and the OU is not created."
items:
description: "A custom key-value pair associated with a resource within your organization.\n\n\nYou can attach tags to any of the following organization resources.\n\n\n * Amazon Web Services account\n\n\n * Organizational unit (OU)\n\n\n * Organization root\n\n\n * Policy"
properties:
key:
type: "string"
value:
type: "string"
type: "object"
type: "array"
required:
- "name"
- "parentID"
type: "object"
status:
description: "OrganizationalUnitStatus defines the observed state of OrganizationalUnit"
properties:
ackResourceMetadata:
description: "All CRs managed by ACK have a common `Status.ACKResourceMetadata` member\nthat is used to contain resource sync state, account ownership,\nconstructed ARN for the resource"
properties:
arn:
description: "ARN is the Amazon Resource Name for the resource. This is a\nglobally-unique identifier and is set only by the ACK service controller\nonce the controller has orchestrated the creation of the resource OR\nwhen it has verified that an \"adopted\" resource (a resource where the\nARN annotation was set by the Kubernetes user on the CR) exists and\nmatches the supplied CR's Spec field values.\nTODO(vijat@): Find a better strategy for resources that do not have ARN in CreateOutputResponse\nhttps://github.com/aws/aws-controllers-k8s/issues/270"
type: "string"
ownerAccountID:
description: "OwnerAccountID is the AWS Account ID of the account that owns the\nbackend AWS service API resource."
type: "string"
region:
description: "Region is the AWS region in which the resource exists or will exist."
type: "string"
required:
- "ownerAccountID"
- "region"
type: "object"
conditions:
description: "All CRS managed by ACK have a common `Status.Conditions` member that\ncontains a collection of `ackv1alpha1.Condition` objects that describe\nthe various terminal states of the CR and its backend AWS service API\nresource"
items:
description: "Condition is the common struct used by all CRDs managed by ACK service\ncontrollers to indicate terminal states of the CR and its backend AWS\nservice API resource"
properties:
lastTransitionTime:
description: "Last time the condition transitioned from one status to another."
format: "date-time"
type: "string"
message:
description: "A human readable message indicating details about the transition."
type: "string"
reason:
description: "The reason for the condition's last transition."
type: "string"
status:
description: "Status of the condition, one of True, False, Unknown."
type: "string"
type:
description: "Type is the type of the Condition"
type: "string"
required:
- "status"
- "type"
type: "object"
type: "array"
id:
description: "The unique identifier (ID) associated with this OU.\n\n\nThe regex pattern (http://wikipedia.org/wiki/regex) for an organizational\nunit ID string requires \"ou-\" followed by from 4 to 32 lowercase letters\nor digits (the ID of the root that contains the OU). This string is followed\nby a second \"-\" dash and from 8 to 32 additional lowercase letters or digits."
type: "string"
type: "object"
type: "object"
served: true
storage: true
subresources:
status: {}
1 change: 1 addition & 0 deletions kube-custom-resources-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ operator_shipwright_io = []
operator_tigera_io = []
operator_victoriametrics_com = []
org_eclipse_che = []
organizations_services_k8s_aws = []
pgv2_percona_com = []
pipes_services_k8s_aws = []
pkg_crossplane_io = []
Expand Down
7 changes: 7 additions & 0 deletions kube-custom-resources-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,11 @@ apiVersion `org.eclipse.che/v1`:
apiVersion `org.eclipse.che/v2`:
- `CheCluster`

## organizations_services_k8s_aws

apiVersion `organizations.services.k8s.aws/v1alpha1`:
- `OrganizationalUnit`

## pgv2_percona_com

apiVersion `pgv2.percona.com/v2`:
Expand Down Expand Up @@ -3205,6 +3210,8 @@ pub mod operator_tigera_io;
pub mod operator_victoriametrics_com;
#[cfg(feature = "org_eclipse_che")]
pub mod org_eclipse_che;
#[cfg(feature = "organizations_services_k8s_aws")]
pub mod organizations_services_k8s_aws;
#[cfg(feature = "pgv2_percona_com")]
pub mod pgv2_percona_com;
#[cfg(feature = "pipes_services_k8s_aws")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod v1alpha1;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod organizationalunits;
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --docs --filename=./crd-catalog/aws-controllers-k8s/organizations-controller/organizations.services.k8s.aws/v1alpha1/organizationalunits.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;
use serde::{Serialize, Deserialize};

/// OrganizationalUnitSpec defines the desired state of OrganizationalUnit.
///
///
/// Contains details about an organizational unit (OU). An OU is a container
/// of Amazon Web Services accounts within a root of an organization. Policies
/// that are attached to an OU apply to all accounts contained in that OU and
/// in any child OUs.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(group = "organizations.services.k8s.aws", version = "v1alpha1", kind = "OrganizationalUnit", plural = "organizationalunits")]
#[kube(namespaced)]
#[kube(status = "OrganizationalUnitStatus")]
#[kube(schema = "disabled")]
pub struct OrganizationalUnitSpec {
/// The friendly name to assign to the new OU.
pub name: String,
/// The unique identifier (ID) of the parent root or OU that you want to create
/// the new OU in.
///
///
/// The regex pattern (http://wikipedia.org/wiki/regex) for a parent ID string
/// requires one of the following:
///
///
/// * Root - A string that begins with "r-" followed by from 4 to 32 lowercase
/// letters or digits.
///
///
/// * Organizational unit (OU) - A string that begins with "ou-" followed
/// by from 4 to 32 lowercase letters or digits (the ID of the root that the
/// OU is in). This string is followed by a second "-" dash and from 8 to
/// 32 additional lowercase letters or digits.
#[serde(rename = "parentID")]
pub parent_id: String,
/// A list of tags that you want to attach to the newly created OU. For each
/// tag in the list, you must specify both a tag key and a value. You can set
/// the value to an empty string, but you can't set it to null. For more information
/// about tagging, see Tagging Organizations resources (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_tagging.html)
/// in the Organizations User Guide.
///
///
/// If any one of the tags is invalid or if you exceed the allowed number of
/// tags for an OU, then the entire request fails and the OU is not created.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<OrganizationalUnitTags>>,
}

/// A custom key-value pair associated with a resource within your organization.
///
///
/// You can attach tags to any of the following organization resources.
///
///
/// * Amazon Web Services account
///
///
/// * Organizational unit (OU)
///
///
/// * Organization root
///
///
/// * Policy
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct OrganizationalUnitTags {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub key: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub value: Option<String>,
}

/// OrganizationalUnitStatus defines the observed state of OrganizationalUnit
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct OrganizationalUnitStatus {
/// All CRs managed by ACK have a common `Status.ACKResourceMetadata` member
/// that is used to contain resource sync state, account ownership,
/// constructed ARN for the resource
#[serde(default, skip_serializing_if = "Option::is_none", rename = "ackResourceMetadata")]
pub ack_resource_metadata: Option<OrganizationalUnitStatusAckResourceMetadata>,
/// All CRS managed by ACK have a common `Status.Conditions` member that
/// contains a collection of `ackv1alpha1.Condition` objects that describe
/// the various terminal states of the CR and its backend AWS service API
/// resource
#[serde(default, skip_serializing_if = "Option::is_none")]
pub conditions: Option<Vec<OrganizationalUnitStatusConditions>>,
/// The unique identifier (ID) associated with this OU.
///
///
/// The regex pattern (http://wikipedia.org/wiki/regex) for an organizational
/// unit ID string requires "ou-" followed by from 4 to 32 lowercase letters
/// or digits (the ID of the root that contains the OU). This string is followed
/// by a second "-" dash and from 8 to 32 additional lowercase letters or digits.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
}

/// All CRs managed by ACK have a common `Status.ACKResourceMetadata` member
/// that is used to contain resource sync state, account ownership,
/// constructed ARN for the resource
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct OrganizationalUnitStatusAckResourceMetadata {
/// ARN is the Amazon Resource Name for the resource. This is a
/// globally-unique identifier and is set only by the ACK service controller
/// once the controller has orchestrated the creation of the resource OR
/// when it has verified that an "adopted" resource (a resource where the
/// ARN annotation was set by the Kubernetes user on the CR) exists and
/// matches the supplied CR's Spec field values.
/// TODO(vijat@): Find a better strategy for resources that do not have ARN in CreateOutputResponse
/// https://github.com/aws/aws-controllers-k8s/issues/270
#[serde(default, skip_serializing_if = "Option::is_none")]
pub arn: Option<String>,
/// OwnerAccountID is the AWS Account ID of the account that owns the
/// backend AWS service API resource.
#[serde(rename = "ownerAccountID")]
pub owner_account_id: String,
/// Region is the AWS region in which the resource exists or will exist.
pub region: String,
}

/// Condition is the common struct used by all CRDs managed by ACK service
/// controllers to indicate terminal states of the CR and its backend AWS
/// service API resource
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct OrganizationalUnitStatusConditions {
/// Last time the condition transitioned from one status to another.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "lastTransitionTime")]
pub last_transition_time: Option<String>,
/// A human readable message indicating details about the transition.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
/// The reason for the condition's last transition.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub reason: Option<String>,
/// Status of the condition, one of True, False, Unknown.
pub status: String,
/// Type is the type of the Condition
#[serde(rename = "type")]
pub r#type: String,
}