From 461c84d3396855d4bd41c4930bbb149bd6d55753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Ho=C3=9F?= Date: Sun, 12 Nov 2023 11:28:56 +0100 Subject: [PATCH] add validatedpatterns/patterns-operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sebastian Hoß --- .reuse/dep5 | 4 + code-generator/src/catalog.rs | 7 + .../v1alpha1/patterns.yaml | 198 ++++++++++++++++++ kube-custom-resources-rs/Cargo.toml | 1 + .../mod.rs | 1 + .../patterns.rs | 154 ++++++++++++++ kube-custom-resources-rs/src/lib.rs | 9 + 7 files changed, 374 insertions(+) create mode 100644 crd-catalog/validatedpatterns/patterns-operator/gitops.hybrid-cloud-patterns.io/v1alpha1/patterns.yaml create mode 100644 kube-custom-resources-rs/src/gitops_hybrid_cloud_patterns_io_v1alpha1/mod.rs create mode 100644 kube-custom-resources-rs/src/gitops_hybrid_cloud_patterns_io_v1alpha1/patterns.rs diff --git a/.reuse/dep5 b/.reuse/dep5 index edf9108d1..509248770 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -743,6 +743,10 @@ Files: crd-catalog/traefik/traefik/* Copyright: The traefik/traefik Authors License: MIT +Files: crd-catalog/validatedpatterns/patterns-operator/* +Copyright: The validatedpatterns/patterns-operator Authors +License: Apache-2.0 + Files: crd-catalog/VictoriaMetrics/operator/* Copyright: The VictoriaMetrics/operator Authors License: Apache-2.0 diff --git a/code-generator/src/catalog.rs b/code-generator/src/catalog.rs index 0430e61e9..83f719751 100644 --- a/code-generator/src/catalog.rs +++ b/code-generator/src/catalog.rs @@ -1930,6 +1930,13 @@ pub const CRD_V1_SOURCES: &'static [UpstreamSource] = &[ "https://github.com/traefik/traefik/blob/master/docs/content/reference/dynamic-configuration/traefik.io_traefikservices.yaml", ], }, + UpstreamSource { + project_name: "validatedpatterns/patterns-operator", + license: APACHE_V2, + urls: &[ + "https://github.com/validatedpatterns/patterns-operator/blob/main/config/crd/bases/gitops.hybrid-cloud-patterns.io_patterns.yaml", + ], + }, UpstreamSource { project_name: "VictoriaMetrics/operator", license: APACHE_V2, diff --git a/crd-catalog/validatedpatterns/patterns-operator/gitops.hybrid-cloud-patterns.io/v1alpha1/patterns.yaml b/crd-catalog/validatedpatterns/patterns-operator/gitops.hybrid-cloud-patterns.io/v1alpha1/patterns.yaml new file mode 100644 index 000000000..a3e96b116 --- /dev/null +++ b/crd-catalog/validatedpatterns/patterns-operator/gitops.hybrid-cloud-patterns.io/v1alpha1/patterns.yaml @@ -0,0 +1,198 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.11.4 + name: patterns.gitops.hybrid-cloud-patterns.io +spec: + group: gitops.hybrid-cloud-patterns.io + names: + kind: Pattern + listKind: PatternList + plural: patterns + shortNames: + - patt + singular: pattern + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.lastStep + name: Step + priority: 1 + type: string + - jsonPath: .status.lastError + name: Error + priority: 2 + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: Pattern is the Schema for the patterns API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More 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. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: PatternSpec defines the desired state of Pattern + properties: + analyticsUUID: + description: Analytics UUID. Leave empty to autogenerate a random one. Not PII information + type: string + clusterGroupName: + type: string + extraParameters: + description: '.Name is dot separated per the helm --set syntax, such as: global.something.field' + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + extraValueFiles: + description: URLs to additional Helm parameter files + items: + type: string + type: array + gitOpsSpec: + properties: + manualSync: + description: 'Require manual intervention before Argo will sync new content. Default: False' + type: boolean + type: object + gitSpec: + properties: + hostname: + description: Optional. FQDN of the git server if automatic parsing from TargetRepo is broken + type: string + originRepo: + description: Upstream git repo containing the pattern to deploy. Used when in-cluster fork to point to the upstream pattern repository + type: string + originRevision: + description: Branch, tag or commit in the upstream git repository. Does not support short-sha's. Default to HEAD + type: string + pollInterval: + default: 180 + description: 'Interval in seconds to poll for drifts between origin and target repositories. Default: 180 seconds' + type: integer + targetRepo: + description: Git repo containing the pattern to deploy. Must use https/http + type: string + targetRevision: + description: 'Branch, tag, or commit to deploy. Does not support short-sha''s. Default: HEAD' + type: string + required: + - targetRepo + type: object + multiSourceConfig: + properties: + clusterGroupChartGitRevision: + default: main + description: The git reference when deploying the clustergroup helm chart directly from a git repo Defaults to 'main'. (Only used when developing the clustergroup helm chart) + type: string + clusterGroupChartVersion: + default: 0.0.* + description: Which chart version for the clustergroup helm chart Defaults to "0.0.*" + type: string + clusterGroupGitRepoUrl: + description: The url when deploying the clustergroup helm chart directly from a git repo Defaults to '' which means not used (Only used when developing the clustergroup helm chart) + type: string + enabled: + default: true + description: (EXPERIMENTAL) Enable multi-source support when deploying the clustergroup argo application + type: boolean + helmRepoUrl: + default: https://charts.validatedpatterns.io/ + description: The helm chart url to fetch the helm charts from in order to deploy the pattern Defaults to https://charts.validatedpatterns.io/ + type: string + type: object + required: + - clusterGroupName + - gitSpec + type: object + status: + description: PatternStatus defines the observed state of Pattern + properties: + analyticsSent: + default: 0 + type: integer + analyticsUUID: + type: string + appClusterDomain: + type: string + applications: + items: + description: PatternApplicationInfo defines the Applications Status for the Pattern. This structure is part of the PatternStatus as an array The Application Status will be included as part of the Observed state of Pattern + properties: + healthMessage: + type: string + healthStatus: + type: string + name: + type: string + namespace: + type: string + syncStatus: + type: string + type: object + type: array + clusterDomain: + type: string + clusterID: + type: string + clusterName: + type: string + clusterPlatform: + type: string + clusterVersion: + type: string + conditions: + items: + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status to another. + format: date-time + type: string + lastUpdateTime: + description: The last time this condition was updated. + format: date-time + type: string + message: + description: A human readable message indicating details about the transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of deployment condition. + type: string + required: + - lastUpdateTime + - status + - type + type: object + type: array + lastError: + description: Last error encountered by the pattern + type: string + lastStep: + description: Last action related to the pattern + type: string + version: + description: Number of updates to the pattern + type: integer + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/kube-custom-resources-rs/Cargo.toml b/kube-custom-resources-rs/Cargo.toml index d4226958d..17e7a217b 100644 --- a/kube-custom-resources-rs/Cargo.toml +++ b/kube-custom-resources-rs/Cargo.toml @@ -139,6 +139,7 @@ gateway_networking_k8s_io_v1alpha2 = [] gateway_networking_k8s_io_v1beta1 = [] gateway_nginx_org_v1alpha1 = [] getambassador_io_v3alpha1 = [] +gitops_hybrid_cloud_patterns_io_v1alpha1 = [] grafana_integreatly_org_v1beta1 = [] hazelcast_com_v1alpha1 = [] helm_toolkit_fluxcd_io_v2beta1 = [] diff --git a/kube-custom-resources-rs/src/gitops_hybrid_cloud_patterns_io_v1alpha1/mod.rs b/kube-custom-resources-rs/src/gitops_hybrid_cloud_patterns_io_v1alpha1/mod.rs new file mode 100644 index 000000000..393919fea --- /dev/null +++ b/kube-custom-resources-rs/src/gitops_hybrid_cloud_patterns_io_v1alpha1/mod.rs @@ -0,0 +1 @@ +pub mod patterns; diff --git a/kube-custom-resources-rs/src/gitops_hybrid_cloud_patterns_io_v1alpha1/patterns.rs b/kube-custom-resources-rs/src/gitops_hybrid_cloud_patterns_io_v1alpha1/patterns.rs new file mode 100644 index 000000000..fd7ea55c1 --- /dev/null +++ b/kube-custom-resources-rs/src/gitops_hybrid_cloud_patterns_io_v1alpha1/patterns.rs @@ -0,0 +1,154 @@ +// WARNING: generated by kopium - manual changes will be overwritten +// kopium command: kopium --docs --filename=./crd-catalog/validatedpatterns/patterns-operator/gitops.hybrid-cloud-patterns.io/v1alpha1/patterns.yaml --derive=Default --derive=PartialEq +// kopium version: 0.16.2 + +use kube::CustomResource; +use serde::{Serialize, Deserialize}; + +/// PatternSpec defines the desired state of Pattern +#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +#[kube(group = "gitops.hybrid-cloud-patterns.io", version = "v1alpha1", kind = "Pattern", plural = "patterns")] +#[kube(namespaced)] +#[kube(status = "PatternStatus")] +#[kube(schema = "disabled")] +pub struct PatternSpec { + /// Analytics UUID. Leave empty to autogenerate a random one. Not PII information + #[serde(default, skip_serializing_if = "Option::is_none", rename = "analyticsUUID")] + pub analytics_uuid: Option, + #[serde(rename = "clusterGroupName")] + pub cluster_group_name: String, + /// .Name is dot separated per the helm --set syntax, such as: global.something.field + #[serde(default, skip_serializing_if = "Option::is_none", rename = "extraParameters")] + pub extra_parameters: Option>, + /// URLs to additional Helm parameter files + #[serde(default, skip_serializing_if = "Option::is_none", rename = "extraValueFiles")] + pub extra_value_files: Option>, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "gitOpsSpec")] + pub git_ops_spec: Option, + #[serde(rename = "gitSpec")] + pub git_spec: PatternGitSpec, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "multiSourceConfig")] + pub multi_source_config: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct PatternExtraParameters { + pub name: String, + pub value: String, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct PatternGitOpsSpec { + /// Require manual intervention before Argo will sync new content. Default: False + #[serde(default, skip_serializing_if = "Option::is_none", rename = "manualSync")] + pub manual_sync: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct PatternGitSpec { + /// Optional. FQDN of the git server if automatic parsing from TargetRepo is broken + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hostname: Option, + /// Upstream git repo containing the pattern to deploy. Used when in-cluster fork to point to the upstream pattern repository + #[serde(default, skip_serializing_if = "Option::is_none", rename = "originRepo")] + pub origin_repo: Option, + /// Branch, tag or commit in the upstream git repository. Does not support short-sha's. Default to HEAD + #[serde(default, skip_serializing_if = "Option::is_none", rename = "originRevision")] + pub origin_revision: Option, + /// Interval in seconds to poll for drifts between origin and target repositories. Default: 180 seconds + #[serde(default, skip_serializing_if = "Option::is_none", rename = "pollInterval")] + pub poll_interval: Option, + /// Git repo containing the pattern to deploy. Must use https/http + #[serde(rename = "targetRepo")] + pub target_repo: String, + /// Branch, tag, or commit to deploy. Does not support short-sha's. Default: HEAD + #[serde(default, skip_serializing_if = "Option::is_none", rename = "targetRevision")] + pub target_revision: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct PatternMultiSourceConfig { + /// The git reference when deploying the clustergroup helm chart directly from a git repo Defaults to 'main'. (Only used when developing the clustergroup helm chart) + #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterGroupChartGitRevision")] + pub cluster_group_chart_git_revision: Option, + /// Which chart version for the clustergroup helm chart Defaults to "0.0.*" + #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterGroupChartVersion")] + pub cluster_group_chart_version: Option, + /// The url when deploying the clustergroup helm chart directly from a git repo Defaults to '' which means not used (Only used when developing the clustergroup helm chart) + #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterGroupGitRepoUrl")] + pub cluster_group_git_repo_url: Option, + /// (EXPERIMENTAL) Enable multi-source support when deploying the clustergroup argo application + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + /// The helm chart url to fetch the helm charts from in order to deploy the pattern Defaults to https://charts.validatedpatterns.io/ + #[serde(default, skip_serializing_if = "Option::is_none", rename = "helmRepoUrl")] + pub helm_repo_url: Option, +} + +/// PatternStatus defines the observed state of Pattern +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct PatternStatus { + #[serde(default, skip_serializing_if = "Option::is_none", rename = "analyticsSent")] + pub analytics_sent: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "analyticsUUID")] + pub analytics_uuid: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "appClusterDomain")] + pub app_cluster_domain: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub applications: Option>, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterDomain")] + pub cluster_domain: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterID")] + pub cluster_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterName")] + pub cluster_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterPlatform")] + pub cluster_platform: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "clusterVersion")] + pub cluster_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub conditions: Option>, + /// Last error encountered by the pattern + #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastError")] + pub last_error: Option, + /// Last action related to the pattern + #[serde(default, skip_serializing_if = "Option::is_none", rename = "lastStep")] + pub last_step: Option, + /// Number of updates to the pattern + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, +} + +/// PatternApplicationInfo defines the Applications Status for the Pattern. This structure is part of the PatternStatus as an array The Application Status will be included as part of the Observed state of Pattern +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct PatternStatusApplications { + #[serde(default, skip_serializing_if = "Option::is_none", rename = "healthMessage")] + pub health_message: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "healthStatus")] + pub health_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub namespace: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "syncStatus")] + pub sync_status: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] +pub struct PatternStatusConditions { + /// 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, + /// The last time this condition was updated. + #[serde(rename = "lastUpdateTime")] + pub last_update_time: String, + /// A human readable message indicating details about the transition. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + /// Status of the condition, one of True, False, Unknown. + pub status: String, + /// Type of deployment condition. + #[serde(rename = "type")] + pub r#type: String, +} + diff --git a/kube-custom-resources-rs/src/lib.rs b/kube-custom-resources-rs/src/lib.rs index 79a43654d..d1aa01832 100644 --- a/kube-custom-resources-rs/src/lib.rs +++ b/kube-custom-resources-rs/src/lib.rs @@ -1086,6 +1086,13 @@ kinds: - `TLSContext` - `TracingService` +## gitops_hybrid_cloud_patterns_io_v1alpha1 + +apiVersion: `gitops.hybrid-cloud-patterns.io/v1alpha1` + +kinds: +- `Pattern` + ## grafana_integreatly_org_v1beta1 apiVersion: `grafana.integreatly.org/v1beta1` @@ -2880,6 +2887,8 @@ pub mod gateway_networking_k8s_io_v1beta1; pub mod gateway_nginx_org_v1alpha1; #[cfg(feature = "getambassador_io_v3alpha1")] pub mod getambassador_io_v3alpha1; +#[cfg(feature = "gitops_hybrid_cloud_patterns_io_v1alpha1")] +pub mod gitops_hybrid_cloud_patterns_io_v1alpha1; #[cfg(feature = "grafana_integreatly_org_v1beta1")] pub mod grafana_integreatly_org_v1beta1; #[cfg(feature = "hazelcast_com_v1alpha1")]