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 more resources for aws-controllers-k8s/prometheusservice-controller #178

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
1 change: 1 addition & 0 deletions code-generator/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[
license: APACHE_V2,
urls: &[
"https://github.com/aws-controllers-k8s/prometheusservice-controller/blob/main/config/crd/bases/prometheusservice.services.k8s.aws_alertmanagerdefinitions.yaml",
"https://github.com/aws-controllers-k8s/prometheusservice-controller/blob/main/config/crd/bases/prometheusservice.services.k8s.aws_loggingconfigurations.yaml",
"https://github.com/aws-controllers-k8s/prometheusservice-controller/blob/main/config/crd/bases/prometheusservice.services.k8s.aws_rulegroupsnamespaces.yaml",
"https://github.com/aws-controllers-k8s/prometheusservice-controller/blob/main/config/crd/bases/prometheusservice.services.k8s.aws_workspaces.yaml",
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
apiVersion: "apiextensions.k8s.io/v1"
kind: "CustomResourceDefinition"
metadata:
annotations:
controller-gen.kubebuilder.io/version: "v0.14.0"
name: "loggingconfigurations.prometheusservice.services.k8s.aws"
spec:
group: "prometheusservice.services.k8s.aws"
names:
kind: "LoggingConfiguration"
listKind: "LoggingConfigurationList"
plural: "loggingconfigurations"
singular: "loggingconfiguration"
scope: "Namespaced"
versions:
- additionalPrinterColumns:
- jsonPath: ".spec.logGroupARN"
name: "LOG-GROUP-ARN"
type: "string"
- jsonPath: ".spec.workspaceID"
name: "WORKSPACE-ID"
type: "string"
name: "v1alpha1"
schema:
openAPIV3Schema:
description: "LoggingConfiguration is the Schema for the LoggingConfigurations 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: "LoggingConfigurationSpec defines the desired state of LoggingConfiguration."
properties:
logGroupARN:
description: "The ARN of the CW log group to which the vended log data will be published."
type: "string"
workspaceID:
description: "The ID of the workspace to vend logs to."
type: "string"
workspaceRef:
description: "AWSResourceReferenceWrapper provides a wrapper around *AWSResourceReference\ntype to provide more user friendly syntax for references using 'from' field\nEx:\nAPIIDRef:\n\n\n\tfrom:\n\t name: my-api"
properties:
from:
description: "AWSResourceReference provides all the values necessary to reference another\nk8s resource for finding the identifier(Id/ARN/Name)"
properties:
name:
type: "string"
type: "object"
type: "object"
required:
- "logGroupARN"
type: "object"
status:
description: "LoggingConfigurationStatus defines the observed state of LoggingConfiguration"
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"
statusCode:
description: "Status code of the logging configuration."
type: "string"
statusReason:
description: "The reason for failure if any."
type: "string"
type: "object"
type: "object"
served: true
storage: true
subresources:
status: {}
1 change: 1 addition & 0 deletions kube-custom-resources-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,7 @@ apiVersion `projectcontour.io/v1alpha1`:

apiVersion `prometheusservice.services.k8s.aws/v1alpha1`:
- `AlertManagerDefinition`
- `LoggingConfiguration`
- `RuleGroupsNamespace`
- `Workspace`

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --docs --filename=./crd-catalog/aws-controllers-k8s/prometheusservice-controller/prometheusservice.services.k8s.aws/v1alpha1/loggingconfigurations.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

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

/// LoggingConfigurationSpec defines the desired state of LoggingConfiguration.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(group = "prometheusservice.services.k8s.aws", version = "v1alpha1", kind = "LoggingConfiguration", plural = "loggingconfigurations")]
#[kube(namespaced)]
#[kube(status = "LoggingConfigurationStatus")]
#[kube(schema = "disabled")]
pub struct LoggingConfigurationSpec {
/// The ARN of the CW log group to which the vended log data will be published.
#[serde(rename = "logGroupARN")]
pub log_group_arn: String,
/// The ID of the workspace to vend logs to.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "workspaceID")]
pub workspace_id: Option<String>,
/// AWSResourceReferenceWrapper provides a wrapper around *AWSResourceReference
/// type to provide more user friendly syntax for references using 'from' field
/// Ex:
/// APIIDRef:
///
///
/// from:
/// name: my-api
#[serde(default, skip_serializing_if = "Option::is_none", rename = "workspaceRef")]
pub workspace_ref: Option<LoggingConfigurationWorkspaceRef>,
}

/// AWSResourceReferenceWrapper provides a wrapper around *AWSResourceReference
/// type to provide more user friendly syntax for references using 'from' field
/// Ex:
/// APIIDRef:
///
///
/// from:
/// name: my-api
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct LoggingConfigurationWorkspaceRef {
/// AWSResourceReference provides all the values necessary to reference another
/// k8s resource for finding the identifier(Id/ARN/Name)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub from: Option<LoggingConfigurationWorkspaceRefFrom>,
}

/// AWSResourceReference provides all the values necessary to reference another
/// k8s resource for finding the identifier(Id/ARN/Name)
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct LoggingConfigurationWorkspaceRefFrom {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
}

/// LoggingConfigurationStatus defines the observed state of LoggingConfiguration
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct LoggingConfigurationStatus {
/// 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<LoggingConfigurationStatusAckResourceMetadata>,
/// 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<LoggingConfigurationStatusConditions>>,
/// Status code of the logging configuration.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "statusCode")]
pub status_code: Option<String>,
/// The reason for failure if any.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "statusReason")]
pub status_reason: 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 LoggingConfigurationStatusAckResourceMetadata {
/// 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 LoggingConfigurationStatusConditions {
/// 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,
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod alertmanagerdefinitions;
pub mod loggingconfigurations;
pub mod rulegroupsnamespaces;
pub mod workspaces;