From 78a05d5c4ce7c0e7b93d8d587f7f00547666b5cb Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Fri, 10 May 2024 15:40:47 +0800 Subject: [PATCH 1/6] Support generic resource in FunctionMesh CRD --- api/compute/v1alpha1/common.go | 17 +- api/compute/v1alpha1/functionmesh_types.go | 46 +- api/compute/v1alpha1/zz_generated.deepcopy.go | 34 +- ...ompute.functionmesh.io-backendconfigs.yaml | 2 +- ...ompute.functionmesh.io-functionmeshes.yaml | 620 ++++++++++++++++- ...crd-compute.functionmesh.io-functions.yaml | 209 +++++- .../crd-compute.functionmesh.io-sinks.yaml | 186 +++++- .../crd-compute.functionmesh.io-sources.yaml | 186 +++++- ...ompute.functionmesh.io_backendconfigs.yaml | 3 +- ...ompute.functionmesh.io_functionmeshes.yaml | 621 +++++++++++++++++- .../compute.functionmesh.io_functions.yaml | 210 +++++- .../bases/compute.functionmesh.io_sinks.yaml | 187 +++++- .../compute.functionmesh.io_sources.yaml | 187 +++++- config/rbac/role.yaml | 1 - config/webhook/manifests.yaml | 2 - controllers/function_mesh.go | 123 ++++ controllers/spec/function_mesh.go | 19 + 17 files changed, 2595 insertions(+), 58 deletions(-) diff --git a/api/compute/v1alpha1/common.go b/api/compute/v1alpha1/common.go index 3a8d90769..b85bbadbf 100644 --- a/api/compute/v1alpha1/common.go +++ b/api/compute/v1alpha1/common.go @@ -369,9 +369,11 @@ const ( // ResourceCondition The `Status` of a given `Condition` and the `Action` needed to reach the `Status` type ResourceCondition struct { - Condition ResourceConditionType `json:"condition,omitempty"` - Status metav1.ConditionStatus `json:"status,omitempty"` - Action ReconcileAction `json:"action,omitempty"` + Condition ResourceConditionType `json:"condition,omitempty"` + Status metav1.ConditionStatus `json:"status,omitempty"` + Action ReconcileAction `json:"action,omitempty"` + ApiVersion string `json:"apiVersion,omitempty"` + Kind string `json:"kind,omitempty"` } type ResourceConditionType string @@ -379,10 +381,11 @@ type ResourceConditionType string const ( Orphaned ResourceConditionType = "Orphaned" - MeshReady ResourceConditionType = "MeshReady" - FunctionReady ResourceConditionType = "FunctionReady" - SourceReady ResourceConditionType = "SourceReady" - SinkReady ResourceConditionType = "SinkReady" + MeshReady ResourceConditionType = "MeshReady" + FunctionReady ResourceConditionType = "FunctionReady" + SourceReady ResourceConditionType = "SourceReady" + SinkReady ResourceConditionType = "SinkReady" + GenericResourceReady ResourceConditionType = "GenericResourceReady" StatefulSetReady ResourceConditionType = "StatefulSetReady" ServiceReady ResourceConditionType = "ServiceReady" diff --git a/api/compute/v1alpha1/functionmesh_types.go b/api/compute/v1alpha1/functionmesh_types.go index 6e34b5922..f2806e66d 100644 --- a/api/compute/v1alpha1/functionmesh_types.go +++ b/api/compute/v1alpha1/functionmesh_types.go @@ -29,20 +29,50 @@ type FunctionMeshSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file - Sources []SourceSpec `json:"sources,omitempty"` - Sinks []SinkSpec `json:"sinks,omitempty"` - Functions []FunctionSpec `json:"functions,omitempty"` + Sources []SourceSpec `json:"sources,omitempty"` + Sinks []SinkSpec `json:"sinks,omitempty"` + Functions []FunctionSpec `json:"functions,omitempty"` + GenericResources []GenericResourceSpec `json:"genericResources,omitempty"` +} + +type GenericResourceSpec struct { + // +kubebuilder:validation:Required + APIVersion string `json:"apiVersion"` + + // +kubebuilder:validation:Required + Kind string `json:"kind"` + + // +kubebuilder:validation:Required + Name string `json:"name"` + + // the field in the resource used to get the spec, default to "spec" + // +kubebuilder:validation:Optional + SpecFieldName string `json:"specFieldName,omitempty"` + + // the field in the resource used to get the status, default to "status" + // +kubebuilder:validation:Optional + StatusFieldName string `json:"statusFieldName,omitempty"` + + // the spec fields of the resource + // +kubebuilder:validation:Optional + // +kubebuilder:pruning:PreserveUnknownFields + Spec *Config `json:"spec,omitempty"` + + // The filed in the `Status` field of Resource used to check whether the resource is ready + // should equal to ConditionTrue when it's ready + ReadyField string `json:"readyField,omitempty"` } // FunctionMeshStatus defines the observed state of FunctionMesh type FunctionMeshStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file - SourceConditions map[string]ResourceCondition `json:"sourceConditions,omitempty"` - SinkConditions map[string]ResourceCondition `json:"sinkConditions,omitempty"` - FunctionConditions map[string]ResourceCondition `json:"functionConditions,omitempty"` - ObservedGeneration int64 `json:"observedGeneration,omitempty"` - Condition *ResourceCondition `json:"condition,omitempty"` + SourceConditions map[string]ResourceCondition `json:"sourceConditions,omitempty"` + SinkConditions map[string]ResourceCondition `json:"sinkConditions,omitempty"` + FunctionConditions map[string]ResourceCondition `json:"functionConditions,omitempty"` + GenericResourceConditions map[string]ResourceCondition `json:"genericCRConditions,omitempty"` + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + Condition *ResourceCondition `json:"condition,omitempty"` } // +genclient diff --git a/api/compute/v1alpha1/zz_generated.deepcopy.go b/api/compute/v1alpha1/zz_generated.deepcopy.go index c8909120f..684f7a04e 100644 --- a/api/compute/v1alpha1/zz_generated.deepcopy.go +++ b/api/compute/v1alpha1/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file @@ -408,6 +407,13 @@ func (in *FunctionMeshSpec) DeepCopyInto(out *FunctionMeshSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.GenericResources != nil { + in, out := &in.GenericResources, &out.GenericResources + *out = make([]GenericResourceSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FunctionMeshSpec. @@ -444,6 +450,13 @@ func (in *FunctionMeshStatus) DeepCopyInto(out *FunctionMeshStatus) { (*out)[key] = val } } + if in.GenericResourceConditions != nil { + in, out := &in.GenericResourceConditions, &out.GenericResourceConditions + *out = make(map[string]ResourceCondition, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } if in.Condition != nil { in, out := &in.Condition, &out.Condition *out = new(ResourceCondition) @@ -589,6 +602,25 @@ func (in *GenericAuth) DeepCopy() *GenericAuth { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GenericResourceSpec) DeepCopyInto(out *GenericResourceSpec) { + *out = *in + if in.Spec != nil { + in, out := &in.Spec, &out.Spec + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericResourceSpec. +func (in *GenericResourceSpec) DeepCopy() *GenericResourceSpec { + if in == nil { + return nil + } + out := new(GenericResourceSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GenericRuntime) DeepCopyInto(out *GenericRuntime) { *out = *in diff --git a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-backendconfigs.yaml b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-backendconfigs.yaml index 888cdbde4..070b04c5a 100644 --- a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-backendconfigs.yaml +++ b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-backendconfigs.yaml @@ -6,7 +6,7 @@ metadata: {{- if eq .Values.admissionWebhook.certificate.provider "cert-manager" }} {{- include "function-mesh-operator.certManager.annotation" . | nindent 4 -}} {{- end }} - controller-gen.kubebuilder.io/version: v0.9.2 + controller-gen.kubebuilder.io/version: v0.15.0 name: backendconfigs.compute.functionmesh.io spec: conversion: diff --git a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml index 93862ea4d..b4d8fcf94 100644 --- a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml +++ b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.2 + controller-gen.kubebuilder.io/version: v0.15.0 name: functionmeshes.compute.functionmesh.io spec: group: compute.functionmesh.io @@ -484,6 +484,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -552,6 +562,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -618,6 +638,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -686,6 +716,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -1260,6 +1300,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1310,6 +1358,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1506,8 +1562,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -1525,6 +1606,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -1942,6 +2025,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1992,6 +2083,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2188,8 +2287,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -2207,6 +2331,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -2652,11 +2778,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -2702,6 +2829,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -2890,6 +3019,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -3336,6 +3502,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -3456,11 +3634,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -3506,6 +3685,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -3517,6 +3698,11 @@ spec: items: type: string type: array + allocatedResourceStatuses: + additionalProperties: + type: string + type: object + x-kubernetes-map-type: granular allocatedResources: additionalProperties: anyOf: @@ -3555,9 +3741,18 @@ spec: - type type: object type: array - phase: + currentVolumeAttributesClassName: type: string - resizeStatus: + modifyVolumeStatus: + properties: + status: + type: string + targetVolumeAttributesClassName: + type: string + required: + - status + type: object + phase: type: string type: object type: object @@ -3613,6 +3808,30 @@ spec: type: object type: object type: array + genericResources: + items: + properties: + apiVersion: + type: string + kind: + type: string + name: + type: string + readyField: + type: string + spec: + type: object + x-kubernetes-preserve-unknown-fields: true + specFieldName: + type: string + statusFieldName: + type: string + required: + - apiVersion + - kind + - name + type: object + type: array sinks: items: properties: @@ -3992,6 +4211,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -4060,6 +4289,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -4126,6 +4365,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -4194,6 +4443,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -4768,6 +5027,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -4818,6 +5085,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -5014,8 +5289,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -5033,6 +5333,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -5450,6 +5752,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -5500,6 +5810,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -5696,8 +6014,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -5715,6 +6058,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -6160,11 +6505,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -6210,6 +6556,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -6398,6 +6746,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -6844,6 +7229,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -7310,6 +7707,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -7378,6 +7785,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -7444,6 +7861,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -7512,6 +7939,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -8086,6 +8523,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -8136,6 +8581,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -8332,8 +8785,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -8351,6 +8829,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -8768,6 +9248,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -8818,6 +9306,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -9014,8 +9510,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -9033,6 +9554,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -9478,11 +10001,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -9528,6 +10052,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -9716,6 +10242,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -10162,6 +10725,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -10247,8 +10822,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object @@ -10257,8 +10836,27 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string + status: + type: string + type: object + type: object + genericCRConditions: + additionalProperties: + properties: + action: + type: string + apiVersion: + type: string + condition: + type: string + kind: + type: string status: type: string type: object @@ -10271,8 +10869,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object @@ -10282,8 +10884,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object diff --git a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functions.yaml b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functions.yaml index f8aa5cbcc..03c270a67 100644 --- a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functions.yaml +++ b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functions.yaml @@ -6,7 +6,7 @@ metadata: {{- if eq .Values.admissionWebhook.certificate.provider "cert-manager" }} {{- include "function-mesh-operator.certManager.annotation" . | nindent 4 -}} {{- end }} - controller-gen.kubebuilder.io/version: v0.9.2 + controller-gen.kubebuilder.io/version: v0.15.0 name: functions.compute.functionmesh.io spec: conversion: @@ -503,6 +503,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -571,6 +581,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -637,6 +657,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -705,6 +735,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -1279,6 +1319,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1329,6 +1377,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1525,8 +1581,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -1544,6 +1625,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -1961,6 +2044,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2011,6 +2102,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2207,8 +2306,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -2226,6 +2350,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -2671,11 +2797,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -2721,6 +2848,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -2909,6 +3038,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -3355,6 +3521,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -3475,11 +3653,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -3525,6 +3704,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -3536,6 +3717,11 @@ spec: items: type: string type: array + allocatedResourceStatuses: + additionalProperties: + type: string + type: object + x-kubernetes-map-type: granular allocatedResources: additionalProperties: anyOf: @@ -3574,9 +3760,18 @@ spec: - type type: object type: array - phase: + currentVolumeAttributesClassName: type: string - resizeStatus: + modifyVolumeStatus: + properties: + status: + type: string + targetVolumeAttributesClassName: + type: string + required: + - status + type: object + phase: type: string type: object type: object @@ -3638,8 +3833,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object diff --git a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-sinks.yaml b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-sinks.yaml index 21294ce9e..220774512 100644 --- a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-sinks.yaml +++ b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-sinks.yaml @@ -6,7 +6,7 @@ metadata: {{- if eq .Values.admissionWebhook.certificate.provider "cert-manager" }} {{- include "function-mesh-operator.certManager.annotation" . | nindent 4 -}} {{- end }} - controller-gen.kubebuilder.io/version: v0.9.2 + controller-gen.kubebuilder.io/version: v0.15.0 name: sinks.compute.functionmesh.io spec: conversion: @@ -424,6 +424,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -492,6 +502,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -558,6 +578,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -626,6 +656,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -1200,6 +1240,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1250,6 +1298,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1446,8 +1502,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -1465,6 +1546,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -1882,6 +1965,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1932,6 +2023,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2128,8 +2227,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -2147,6 +2271,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -2592,11 +2718,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -2642,6 +2769,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -2830,6 +2959,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -3276,6 +3442,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -3374,8 +3552,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object diff --git a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-sources.yaml b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-sources.yaml index b050a1295..3842ec05a 100644 --- a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-sources.yaml +++ b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-sources.yaml @@ -6,7 +6,7 @@ metadata: {{- if eq .Values.admissionWebhook.certificate.provider "cert-manager" }} {{- include "function-mesh-operator.certManager.annotation" . | nindent 4 -}} {{- end }} - controller-gen.kubebuilder.io/version: v0.9.2 + controller-gen.kubebuilder.io/version: v0.15.0 name: sources.compute.functionmesh.io spec: conversion: @@ -419,6 +419,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -487,6 +497,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -553,6 +573,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -621,6 +651,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -1195,6 +1235,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1245,6 +1293,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1441,8 +1497,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -1460,6 +1541,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -1877,6 +1960,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1927,6 +2018,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2123,8 +2222,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -2142,6 +2266,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -2587,11 +2713,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -2637,6 +2764,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -2825,6 +2954,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -3271,6 +3437,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -3355,8 +3533,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object diff --git a/config/crd/bases/compute.functionmesh.io_backendconfigs.yaml b/config/crd/bases/compute.functionmesh.io_backendconfigs.yaml index 68b0d271c..96c16a69e 100644 --- a/config/crd/bases/compute.functionmesh.io_backendconfigs.yaml +++ b/config/crd/bases/compute.functionmesh.io_backendconfigs.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.15.0 name: backendconfigs.compute.functionmesh.io spec: group: compute.functionmesh.io diff --git a/config/crd/bases/compute.functionmesh.io_functionmeshes.yaml b/config/crd/bases/compute.functionmesh.io_functionmeshes.yaml index f8c01e895..028842df6 100644 --- a/config/crd/bases/compute.functionmesh.io_functionmeshes.yaml +++ b/config/crd/bases/compute.functionmesh.io_functionmeshes.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.15.0 name: functionmeshes.compute.functionmesh.io spec: group: compute.functionmesh.io @@ -485,6 +484,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -553,6 +562,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -619,6 +638,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -687,6 +716,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -1261,6 +1300,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1311,6 +1358,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1507,8 +1562,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -1526,6 +1606,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -1943,6 +2025,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1993,6 +2083,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2189,8 +2287,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -2208,6 +2331,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -2653,11 +2778,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -2703,6 +2829,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -2891,6 +3019,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -3337,6 +3502,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -3457,11 +3634,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -3507,6 +3685,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -3518,6 +3698,11 @@ spec: items: type: string type: array + allocatedResourceStatuses: + additionalProperties: + type: string + type: object + x-kubernetes-map-type: granular allocatedResources: additionalProperties: anyOf: @@ -3556,9 +3741,18 @@ spec: - type type: object type: array - phase: + currentVolumeAttributesClassName: type: string - resizeStatus: + modifyVolumeStatus: + properties: + status: + type: string + targetVolumeAttributesClassName: + type: string + required: + - status + type: object + phase: type: string type: object type: object @@ -3614,6 +3808,30 @@ spec: type: object type: object type: array + genericResources: + items: + properties: + apiVersion: + type: string + kind: + type: string + name: + type: string + readyField: + type: string + spec: + type: object + x-kubernetes-preserve-unknown-fields: true + specFieldName: + type: string + statusFieldName: + type: string + required: + - apiVersion + - kind + - name + type: object + type: array sinks: items: properties: @@ -3993,6 +4211,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -4061,6 +4289,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -4127,6 +4365,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -4195,6 +4443,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -4769,6 +5027,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -4819,6 +5085,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -5015,8 +5289,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -5034,6 +5333,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -5451,6 +5752,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -5501,6 +5810,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -5697,8 +6014,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -5716,6 +6058,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -6161,11 +6505,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -6211,6 +6556,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -6399,6 +6746,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -6845,6 +7229,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -7311,6 +7707,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -7379,6 +7785,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -7445,6 +7861,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -7513,6 +7939,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -8087,6 +8523,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -8137,6 +8581,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -8333,8 +8785,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -8352,6 +8829,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -8769,6 +9248,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -8819,6 +9306,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -9015,8 +9510,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -9034,6 +9554,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -9479,11 +10001,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -9529,6 +10052,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -9717,6 +10242,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -10163,6 +10725,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -10248,8 +10822,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object @@ -10258,8 +10836,27 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string + status: + type: string + type: object + type: object + genericCRConditions: + additionalProperties: + properties: + action: + type: string + apiVersion: + type: string + condition: + type: string + kind: + type: string status: type: string type: object @@ -10272,8 +10869,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object @@ -10283,8 +10884,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object diff --git a/config/crd/bases/compute.functionmesh.io_functions.yaml b/config/crd/bases/compute.functionmesh.io_functions.yaml index 07b4ca0fc..5bab3b933 100644 --- a/config/crd/bases/compute.functionmesh.io_functions.yaml +++ b/config/crd/bases/compute.functionmesh.io_functions.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.15.0 name: functions.compute.functionmesh.io spec: group: compute.functionmesh.io @@ -482,6 +481,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -550,6 +559,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -616,6 +635,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -684,6 +713,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -1258,6 +1297,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1308,6 +1355,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1504,8 +1559,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -1523,6 +1603,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -1940,6 +2022,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1990,6 +2080,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2186,8 +2284,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -2205,6 +2328,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -2650,11 +2775,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -2700,6 +2826,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -2888,6 +3016,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -3334,6 +3499,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -3454,11 +3631,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -3504,6 +3682,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -3515,6 +3695,11 @@ spec: items: type: string type: array + allocatedResourceStatuses: + additionalProperties: + type: string + type: object + x-kubernetes-map-type: granular allocatedResources: additionalProperties: anyOf: @@ -3553,9 +3738,18 @@ spec: - type type: object type: array - phase: + currentVolumeAttributesClassName: type: string - resizeStatus: + modifyVolumeStatus: + properties: + status: + type: string + targetVolumeAttributesClassName: + type: string + required: + - status + type: object + phase: type: string type: object type: object @@ -3617,8 +3811,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object diff --git a/config/crd/bases/compute.functionmesh.io_sinks.yaml b/config/crd/bases/compute.functionmesh.io_sinks.yaml index 984826079..474f8bef2 100644 --- a/config/crd/bases/compute.functionmesh.io_sinks.yaml +++ b/config/crd/bases/compute.functionmesh.io_sinks.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.15.0 name: sinks.compute.functionmesh.io spec: group: compute.functionmesh.io @@ -403,6 +402,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -471,6 +480,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -537,6 +556,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -605,6 +634,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -1179,6 +1218,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1229,6 +1276,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1425,8 +1480,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -1444,6 +1524,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -1861,6 +1943,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1911,6 +2001,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2107,8 +2205,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -2126,6 +2249,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -2571,11 +2696,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -2621,6 +2747,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -2809,6 +2937,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -3255,6 +3420,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -3353,8 +3530,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object diff --git a/config/crd/bases/compute.functionmesh.io_sources.yaml b/config/crd/bases/compute.functionmesh.io_sources.yaml index 028ddf78c..79c4138fd 100644 --- a/config/crd/bases/compute.functionmesh.io_sources.yaml +++ b/config/crd/bases/compute.functionmesh.io_sources.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.15.0 name: sources.compute.functionmesh.io spec: group: compute.functionmesh.io @@ -398,6 +397,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -466,6 +475,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -532,6 +551,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -600,6 +629,16 @@ spec: type: object type: object x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic namespaceSelector: properties: matchExpressions: @@ -1174,6 +1213,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1224,6 +1271,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1420,8 +1475,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -1439,6 +1519,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -1856,6 +1938,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -1906,6 +1996,14 @@ spec: required: - port type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object tcpSocket: properties: host: @@ -2102,8 +2200,33 @@ spec: format: int32 type: integer type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -2121,6 +2244,8 @@ spec: x-kubernetes-int-or-string: true type: object type: object + restartPolicy: + type: string securityContext: properties: allowPrivilegeEscalation: @@ -2566,11 +2691,12 @@ spec: type: string name: type: string + namespace: + type: string required: - kind - name type: object - x-kubernetes-map-type: atomic resources: properties: limits: @@ -2616,6 +2742,8 @@ spec: x-kubernetes-map-type: atomic storageClassName: type: string + volumeAttributesClassName: + type: string volumeMode: type: string volumeName: @@ -2804,6 +2932,43 @@ spec: sources: items: properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object configMap: properties: items: @@ -3250,6 +3415,18 @@ spec: type: integer resources: properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map limits: additionalProperties: anyOf: @@ -3334,8 +3511,12 @@ spec: properties: action: type: string + apiVersion: + type: string condition: type: string + kind: + type: string status: type: string type: object diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 7ba2a2733..0f8dd41ef 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -2,7 +2,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - creationTimestamp: null name: manager-role rules: - apiGroups: diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index 79400e6d4..47cbd5b2d 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -2,7 +2,6 @@ apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: - creationTimestamp: null name: mutating-webhook-configuration webhooks: - admissionReviewVersions: @@ -72,7 +71,6 @@ webhooks: apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration metadata: - creationTimestamp: null name: validating-webhook-configuration webhooks: - admissionReviewVersions: diff --git a/controllers/function_mesh.go b/controllers/function_mesh.go index 3a08fdd08..c0af78c99 100644 --- a/controllers/function_mesh.go +++ b/controllers/function_mesh.go @@ -24,6 +24,7 @@ import ( "github.com/streamnative/function-mesh/controllers/spec" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" ) @@ -43,6 +44,10 @@ func (r *FunctionMeshReconciler) ObserveFunctionMesh(ctx context.Context, req ct return err } + if err := r.observeGenericResources(ctx, mesh); err != nil { + return err + } + // Observation only r.observeMeshes(mesh) @@ -231,6 +236,80 @@ func (r *FunctionMeshReconciler) observeSinks(ctx context.Context, mesh *v1alpha return nil } +func (r *FunctionMeshReconciler) observeGenericResources(ctx context.Context, mesh *v1alpha1.FunctionMesh) error { + orphanedResources := map[string]bool{} + if len(mesh.Status.GenericResourceConditions) > 0 { + for name := range mesh.Status.GenericResourceConditions { + orphanedResources[name] = true + } + } + + for _, resource := range mesh.Spec.GenericResources { + delete(orphanedResources, resource.Name) + + // present the original name to use in Status, but underlying use the complete-name + condition, ok := mesh.Status.GenericResourceConditions[resource.Name] + if !ok { + mesh.Status.GenericResourceConditions[resource.Name] = v1alpha1.ResourceCondition{ + Condition: v1alpha1.SinkReady, + Status: metav1.ConditionFalse, + Action: v1alpha1.Create, + ApiVersion: resource.APIVersion, + Kind: resource.Kind, + } + continue + } + obj := &unstructured.Unstructured{} + obj.SetAPIVersion(resource.APIVersion) + obj.SetKind(resource.Kind) + obj.SetName(resource.Name) + obj.SetNamespace(mesh.Namespace) + + err := r.Get(ctx, types.NamespacedName{ + Namespace: mesh.Namespace, + Name: resource.Name, + }, obj) + if err != nil { + if errors.IsNotFound(err) { + r.Log.Info(resource.Kind+" is not ready", "name", resource.Name) + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.Create, metav1.ConditionFalse) + mesh.Status.GenericResourceConditions[resource.Name] = condition + continue + } + return err + } + + statusFieldName := "status" + if resource.StatusFieldName != "" { + statusFieldName = resource.StatusFieldName + } + status, found, err := unstructured.NestedMap(obj.Object, statusFieldName) + // if status field is not present, we consider the resource is ready + if err != nil || !found { + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) + } + + if resource.ReadyField != "" { + readyValue, ok := status[resource.ReadyField].(metav1.ConditionStatus) + if ok && readyValue == metav1.ConditionTrue { + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) + } else { + // resource created but not ready, we need to wait + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.Wait, metav1.ConditionFalse) + } + } + } + + for resourceName, isOrphaned := range orphanedResources { + if isOrphaned { + if condition, ok := mesh.Status.GenericResourceConditions[resourceName]; ok { + condition.SetCondition(v1alpha1.Orphaned, v1alpha1.Delete, metav1.ConditionTrue) + } + } + } + return nil +} + func (r *FunctionMeshReconciler) observeMeshes(mesh *v1alpha1.FunctionMesh) { for _, cond := range mesh.Status.FunctionConditions { if cond.Condition == v1alpha1.FunctionReady && cond.Status == metav1.ConditionTrue { @@ -256,6 +335,14 @@ func (r *FunctionMeshReconciler) observeMeshes(mesh *v1alpha1.FunctionMesh) { return } + for _, cond := range mesh.Status.GenericResourceConditions { + if cond.Condition == v1alpha1.GenericResourceReady && cond.Status == metav1.ConditionTrue { + continue + } + mesh.Status.Condition.SetCondition(v1alpha1.MeshReady, v1alpha1.Wait, metav1.ConditionFalse) + return + } + mesh.Status.Condition.SetCondition(v1alpha1.MeshReady, v1alpha1.NoAction, metav1.ConditionTrue) } @@ -313,6 +400,24 @@ func (r *FunctionMeshReconciler) UpdateFunctionMesh(ctx context.Context, req ctr } } + for _, genericCRSpec := range mesh.Spec.GenericResources { + condition := mesh.Status.SourceConditions[genericCRSpec.Name] + if !newGeneration && + condition.Status == metav1.ConditionTrue && + condition.Action == v1alpha1.NoAction { + continue + } + obj := spec.MakeGenericCRComponent(mesh, &genericCRSpec) + + // Create or update the resource + if _, err := ctrl.CreateOrUpdate(ctx, r.Client, obj, func() error { + return nil + }); err != nil { + r.Log.Error(err, "failed to handle "+genericCRSpec.Kind, "name", genericCRSpec.Name, "action", "createOrUpdate") + return err + } + } + // handle logic for cleaning up orphaned subcomponents if len(mesh.Spec.Functions) != len(mesh.Status.FunctionConditions) { for functionName, functionCondition := range mesh.Status.FunctionConditions { @@ -389,6 +494,24 @@ func (r *FunctionMeshReconciler) UpdateFunctionMesh(ctx context.Context, req ctr } } + if len(mesh.Spec.GenericResources) != len(mesh.Status.GenericResourceConditions) { + for crName, crCondition := range mesh.Status.GenericResourceConditions { + if crCondition.Condition == v1alpha1.Orphaned { + // clean up the orphaned genericCRs + obj := &unstructured.Unstructured{} + obj.SetAPIVersion(crCondition.ApiVersion) + obj.SetKind(crCondition.Kind) + obj.SetName(crName) + obj.SetNamespace(mesh.Namespace) + if err := r.Delete(ctx, obj); err != nil && !errors.IsNotFound(err) { + r.Log.Error(err, "failed to delete orphaned genericCR", "name", crName) + return err + } + delete(mesh.Status.GenericResourceConditions, crName) + } + } + } + return nil } diff --git a/controllers/spec/function_mesh.go b/controllers/spec/function_mesh.go index e39c93e73..db4193e57 100644 --- a/controllers/spec/function_mesh.go +++ b/controllers/spec/function_mesh.go @@ -20,6 +20,7 @@ package spec import ( "github.com/streamnative/function-mesh/api/compute/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) func MakeFunctionComponent(functionName string, mesh *v1alpha1.FunctionMesh, @@ -73,3 +74,21 @@ func MakeSinkComponent(sinkName string, mesh *v1alpha1.FunctionMesh, spec *v1alp Spec: *spec, } } + +func MakeGenericCRComponent(mesh *v1alpha1.FunctionMesh, spec *v1alpha1.GenericResourceSpec) *unstructured.Unstructured { + obj := &unstructured.Unstructured{} + obj.SetAPIVersion(spec.APIVersion) + obj.SetKind(spec.Kind) + obj.SetName(spec.Name) + obj.SetNamespace(mesh.Namespace) + + specFieldName := "spec" + if spec.SpecFieldName != "" { + specFieldName = spec.SpecFieldName + } + obj.Object[specFieldName] = spec.Spec + + // Set owner reference for garbage collection + obj.SetOwnerReferences([]metav1.OwnerReference{*metav1.NewControllerRef(mesh, mesh.GroupVersionKind())}) + return obj +} From fa83efcb4ea8d43176d31c98f0a78e2bd0e48c26 Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Fri, 10 May 2024 16:03:38 +0800 Subject: [PATCH 2/6] Add ci test --- .../manifests.yaml | 112 ++++++++++++++++++ .../verify.sh | 66 +++++++++++ api/compute/v1alpha1/functionmesh_types.go | 6 +- api/compute/v1alpha1/zz_generated.deepcopy.go | 5 + ...ompute.functionmesh.io-functionmeshes.yaml | 8 +- ...ompute.functionmesh.io_functionmeshes.yaml | 8 +- controllers/function_mesh.go | 55 +++++---- controllers/spec/function_mesh.go | 4 +- 8 files changed, 232 insertions(+), 32 deletions(-) create mode 100644 .ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml create mode 100644 .ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh diff --git a/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml b/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml new file mode 100644 index 000000000..e566640a8 --- /dev/null +++ b/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml @@ -0,0 +1,112 @@ +apiVersion: compute.functionmesh.io/v1alpha1 +kind: FunctionMesh +metadata: + name: functionmesh-generic-resources-sample +spec: + genericResources: + - apiVersion: "compute.functionmesh.io/v1alpha1" + kind: "Function" + name: java-function + spec: + name: java-function + image: streamnative/pulsar-functions-java-sample:3.2.2.1 + className: org.apache.pulsar.functions.api.examples.ExclamationFunction + replicas: 1 + maxReplicas: 1 + input: + topics: + - persistent://public/default/functionmesh-generic-resource-input-topic + typeClassName: java.lang.String + output: + topic: persistent://public/default/functionmesh-generic-resource-java-topic + typeClassName: java.lang.String + pulsar: + pulsarConfig: "mesh-test-pulsar" + java: + jar: /pulsar/examples/api-examples.jar + forwardSourceMessageProperty: true + autoAck: true + resources: + requests: + cpu: "0.1" + memory: 1G + limits: + cpu: "0.2" + memory: 1.1G + clusterName: test + readyFields: + - "StatefulSet" + - "Service" + - apiVersion: "compute.functionmesh.io/v1alpha1" + kind: "Function" + name: golang-function + spec: + name: golang-function + image: streamnative/pulsar-functions-go-sample:3.2.2.1 + replicas: 1 + maxReplicas: 1 + input: + topics: + - persistent://public/default/functionmesh-generic-resource-java-topic + typeClassName: java.lang.String + output: + topic: persistent://public/default/functionmesh-generic-resource-golang-topic + typeClassName: java.lang.String + pulsar: + pulsarConfig: "mesh-test-pulsar" + golang: + go: /pulsar/examples/go-exclamation-func + forwardSourceMessageProperty: true + autoAck: true + resources: + requests: + cpu: "0.1" + memory: 1G + limits: + cpu: "0.2" + memory: 1.1G + clusterName: test + readyFields: + - "StatefulSet" + - "Service" + - apiVersion: "compute.functionmesh.io/v1alpha1" + kind: "Function" + name: python-function + spec: + name: python-function + image: streamnative/pulsar-functions-python-sample:3.2.2.1 + className: exclamation_function.ExclamationFunction + replicas: 1 + maxReplicas: 1 + input: + topics: + - persistent://public/default/functionmesh-generic-resource-golang-topic + typeClassName: java.lang.String + output: + topic: persistent://public/default/functionmesh-generic-resource-python-topic + typeClassName: java.lang.String + pulsar: + pulsarConfig: "mesh-test-pulsar" + python: + py: /pulsar/examples/python-examples/exclamation_function.py + forwardSourceMessageProperty: true + autoAck: true + resources: + requests: + cpu: "0.1" + memory: 1G + limits: + cpu: "0.2" + memory: 1.1G + clusterName: test + readyFields: + - "StatefulSet" + - "Service" +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: mesh-test-pulsar +data: + webServiceURL: http://sn-platform-pulsar-broker.default.svc.cluster.local:8080 + brokerServiceURL: pulsar://sn-platform-pulsar-broker.default.svc.cluster.local:6650 diff --git a/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh b/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh new file mode 100644 index 000000000..f06e96324 --- /dev/null +++ b/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +set -e + +E2E_DIR=$(dirname "$0") +BASE_DIR=$(cd "${E2E_DIR}"/../../../../..;pwd) +PULSAR_NAMESPACE=${PULSAR_NAMESPACE:-"default"} +PULSAR_RELEASE_NAME=${PULSAR_RELEASE_NAME:-"sn-platform"} +E2E_KUBECONFIG=${E2E_KUBECONFIG:-"/tmp/e2e-k8s.config"} + +source "${BASE_DIR}"/.ci/helm.sh + +if [ ! "$KUBECONFIG" ]; then + export KUBECONFIG=${E2E_KUBECONFIG} +fi + +manifests_file="${BASE_DIR}"/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml + +kubectl apply -f "${manifests_file}" > /dev/null 2>&1 + +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-java-function 2>&1) +if [ $? -ne 0 ]; then + echo "$verify_fm_result" + kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true + exit 1 +fi + +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-golang-function 2>&1) +if [ $? -ne 0 ]; then + echo "$verify_fm_result" + kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true + exit 1 +fi + +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-python-function 2>&1) +if [ $? -ne 0 ]; then + echo "$verify_fm_result" + kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true + exit 1 +fi + +verify_fm_result=$(NAMESPACE=${PULSAR_NAMESPACE} CLUSTER=${PULSAR_RELEASE_NAME} ci::verify_exclamation_function "persistent://public/default/functionmesh-generic-resource-input-topic" "persistent://public/default/functionmesh-generic-resource-python-topic" "test-message" "test-message!!!" 10 2>&1) +if [ $? -eq 0 ]; then + echo "e2e-test: ok" | yq eval - +else + echo "$verify_fm_result" +fi +kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true diff --git a/api/compute/v1alpha1/functionmesh_types.go b/api/compute/v1alpha1/functionmesh_types.go index f2806e66d..2e056fb90 100644 --- a/api/compute/v1alpha1/functionmesh_types.go +++ b/api/compute/v1alpha1/functionmesh_types.go @@ -58,9 +58,9 @@ type GenericResourceSpec struct { // +kubebuilder:pruning:PreserveUnknownFields Spec *Config `json:"spec,omitempty"` - // The filed in the `Status` field of Resource used to check whether the resource is ready + // The fields in the `Status` field of Resource used to check whether the resource is ready // should equal to ConditionTrue when it's ready - ReadyField string `json:"readyField,omitempty"` + ReadyFields []string `json:"readyFields,omitempty"` } // FunctionMeshStatus defines the observed state of FunctionMesh @@ -70,7 +70,7 @@ type FunctionMeshStatus struct { SourceConditions map[string]ResourceCondition `json:"sourceConditions,omitempty"` SinkConditions map[string]ResourceCondition `json:"sinkConditions,omitempty"` FunctionConditions map[string]ResourceCondition `json:"functionConditions,omitempty"` - GenericResourceConditions map[string]ResourceCondition `json:"genericCRConditions,omitempty"` + GenericResourceConditions map[string]ResourceCondition `json:"genericResourceConditions,omitempty"` ObservedGeneration int64 `json:"observedGeneration,omitempty"` Condition *ResourceCondition `json:"condition,omitempty"` } diff --git a/api/compute/v1alpha1/zz_generated.deepcopy.go b/api/compute/v1alpha1/zz_generated.deepcopy.go index 684f7a04e..d2a956881 100644 --- a/api/compute/v1alpha1/zz_generated.deepcopy.go +++ b/api/compute/v1alpha1/zz_generated.deepcopy.go @@ -609,6 +609,11 @@ func (in *GenericResourceSpec) DeepCopyInto(out *GenericResourceSpec) { in, out := &in.Spec, &out.Spec *out = (*in).DeepCopy() } + if in.ReadyFields != nil { + in, out := &in.ReadyFields, &out.ReadyFields + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericResourceSpec. diff --git a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml index b4d8fcf94..2397ddd5b 100644 --- a/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml +++ b/charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml @@ -3817,8 +3817,10 @@ spec: type: string name: type: string - readyField: - type: string + readyFields: + items: + type: string + type: array spec: type: object x-kubernetes-preserve-unknown-fields: true @@ -10846,7 +10848,7 @@ spec: type: string type: object type: object - genericCRConditions: + genericResourceConditions: additionalProperties: properties: action: diff --git a/config/crd/bases/compute.functionmesh.io_functionmeshes.yaml b/config/crd/bases/compute.functionmesh.io_functionmeshes.yaml index 028842df6..9f641072b 100644 --- a/config/crd/bases/compute.functionmesh.io_functionmeshes.yaml +++ b/config/crd/bases/compute.functionmesh.io_functionmeshes.yaml @@ -3817,8 +3817,10 @@ spec: type: string name: type: string - readyField: - type: string + readyFields: + items: + type: string + type: array spec: type: object x-kubernetes-preserve-unknown-fields: true @@ -10846,7 +10848,7 @@ spec: type: string type: object type: object - genericCRConditions: + genericResourceConditions: additionalProperties: properties: action: diff --git a/controllers/function_mesh.go b/controllers/function_mesh.go index c0af78c99..8960c39ec 100644 --- a/controllers/function_mesh.go +++ b/controllers/function_mesh.go @@ -267,7 +267,7 @@ func (r *FunctionMeshReconciler) observeGenericResources(ctx context.Context, me err := r.Get(ctx, types.NamespacedName{ Namespace: mesh.Namespace, - Name: resource.Name, + Name: makeComponentName(mesh.Name, resource.Name), }, obj) if err != nil { if errors.IsNotFound(err) { @@ -289,15 +289,19 @@ func (r *FunctionMeshReconciler) observeGenericResources(ctx context.Context, me condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) } - if resource.ReadyField != "" { - readyValue, ok := status[resource.ReadyField].(metav1.ConditionStatus) - if ok && readyValue == metav1.ConditionTrue { - condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) - } else { - // resource created but not ready, we need to wait - condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.Wait, metav1.ConditionFalse) + componentReady := true + for _, readyField := range resource.ReadyFields { + readyValue, ok := status[readyField].(metav1.ConditionStatus) + if !ok || readyValue != metav1.ConditionTrue { + componentReady = false + break } } + if componentReady { + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) + } else { + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.Wait, metav1.ConditionFalse) + } } for resourceName, isOrphaned := range orphanedResources { @@ -400,20 +404,20 @@ func (r *FunctionMeshReconciler) UpdateFunctionMesh(ctx context.Context, req ctr } } - for _, genericCRSpec := range mesh.Spec.GenericResources { - condition := mesh.Status.SourceConditions[genericCRSpec.Name] + for _, genericResource := range mesh.Spec.GenericResources { + condition := mesh.Status.SourceConditions[genericResource.Name] if !newGeneration && condition.Status == metav1.ConditionTrue && condition.Action == v1alpha1.NoAction { continue } - obj := spec.MakeGenericCRComponent(mesh, &genericCRSpec) + obj := spec.MakeGenericResourceComponent(makeComponentName(mesh.Name, genericResource.Name), mesh, &genericResource) // Create or update the resource if _, err := ctrl.CreateOrUpdate(ctx, r.Client, obj, func() error { return nil }); err != nil { - r.Log.Error(err, "failed to handle "+genericCRSpec.Kind, "name", genericCRSpec.Name, "action", "createOrUpdate") + r.Log.Error(err, "failed to handle "+genericResource.Kind, "name", genericResource.Name, "action", "createOrUpdate") return err } } @@ -495,19 +499,28 @@ func (r *FunctionMeshReconciler) UpdateFunctionMesh(ctx context.Context, req ctr } if len(mesh.Spec.GenericResources) != len(mesh.Status.GenericResourceConditions) { - for crName, crCondition := range mesh.Status.GenericResourceConditions { - if crCondition.Condition == v1alpha1.Orphaned { - // clean up the orphaned genericCRs + for resourceName, resourceCondition := range mesh.Status.GenericResourceConditions { + if resourceCondition.Condition == v1alpha1.Orphaned { + // clean up the orphaned generic resource obj := &unstructured.Unstructured{} - obj.SetAPIVersion(crCondition.ApiVersion) - obj.SetKind(crCondition.Kind) - obj.SetName(crName) - obj.SetNamespace(mesh.Namespace) + obj.SetAPIVersion(resourceCondition.ApiVersion) + obj.SetKind(resourceCondition.Kind) + if err := r.Get(ctx, types.NamespacedName{ + Namespace: mesh.Namespace, + Name: makeComponentName(mesh.Name, resourceName), + }, obj); err != nil { + if errors.IsNotFound(err) { + delete(mesh.Status.GenericResourceConditions, resourceName) + continue + } + r.Log.Error(err, "failed to get orphaned generic resource", "name", resourceName) + return err + } if err := r.Delete(ctx, obj); err != nil && !errors.IsNotFound(err) { - r.Log.Error(err, "failed to delete orphaned genericCR", "name", crName) + r.Log.Error(err, "failed to delete orphaned generic resource", "name", resourceName) return err } - delete(mesh.Status.GenericResourceConditions, crName) + delete(mesh.Status.GenericResourceConditions, resourceName) } } } diff --git a/controllers/spec/function_mesh.go b/controllers/spec/function_mesh.go index db4193e57..3cc989300 100644 --- a/controllers/spec/function_mesh.go +++ b/controllers/spec/function_mesh.go @@ -75,11 +75,11 @@ func MakeSinkComponent(sinkName string, mesh *v1alpha1.FunctionMesh, spec *v1alp } } -func MakeGenericCRComponent(mesh *v1alpha1.FunctionMesh, spec *v1alpha1.GenericResourceSpec) *unstructured.Unstructured { +func MakeGenericResourceComponent(resourceName string, mesh *v1alpha1.FunctionMesh, spec *v1alpha1.GenericResourceSpec) *unstructured.Unstructured { obj := &unstructured.Unstructured{} obj.SetAPIVersion(spec.APIVersion) obj.SetKind(spec.Kind) - obj.SetName(spec.Name) + obj.SetName(resourceName) obj.SetNamespace(mesh.Namespace) specFieldName := "spec" From 4106431d973ce0b8ca00f874fae21182e6ada22b Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Sat, 11 May 2024 08:00:25 +0800 Subject: [PATCH 3/6] adjust logic --- controllers/function_mesh.go | 43 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/controllers/function_mesh.go b/controllers/function_mesh.go index 8960c39ec..f18e733ec 100644 --- a/controllers/function_mesh.go +++ b/controllers/function_mesh.go @@ -279,28 +279,33 @@ func (r *FunctionMeshReconciler) observeGenericResources(ctx context.Context, me return err } - statusFieldName := "status" - if resource.StatusFieldName != "" { - statusFieldName = resource.StatusFieldName - } - status, found, err := unstructured.NestedMap(obj.Object, statusFieldName) - // if status field is not present, we consider the resource is ready - if err != nil || !found { - condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) - } + // check whether the resource is ready or not + if len(resource.ReadyFields) > 0 { + statusFieldName := "status" + if resource.StatusFieldName != "" { + statusFieldName = resource.StatusFieldName + } + status, found, err := unstructured.NestedMap(obj.Object, statusFieldName) + // if status field is not present, we consider the resource is ready + if err != nil || !found { + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) + } - componentReady := true - for _, readyField := range resource.ReadyFields { - readyValue, ok := status[readyField].(metav1.ConditionStatus) - if !ok || readyValue != metav1.ConditionTrue { - componentReady = false - break + componentReady := true + for _, readyField := range resource.ReadyFields { + readyValue, ok := status[readyField].(metav1.ConditionStatus) + if !ok || readyValue != metav1.ConditionTrue { + componentReady = false + break + } } - } - if componentReady { + if componentReady { + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) + } else { + condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.Wait, metav1.ConditionFalse) + } + } else { // if `readyFields` is not set, we assume the resource is ready condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.NoAction, metav1.ConditionTrue) - } else { - condition.SetCondition(v1alpha1.GenericResourceReady, v1alpha1.Wait, metav1.ConditionFalse) } } From 75e0952de88885dd184859a991fc2561a87b9fff Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Sat, 11 May 2024 10:34:23 +0800 Subject: [PATCH 4/6] Add ci --- .../functionmesh-with-generic-resources/manifests.yaml | 2 +- .../cases/functionmesh-with-generic-resources/verify.sh | 6 +++--- .ci/tests/integration/e2e_with_tls.yaml | 2 ++ controllers/function_mesh.go | 2 +- controllers/functionmesh_controller.go | 3 +++ controllers/spec/common.go | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml b/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml index e566640a8..0d534a47c 100644 --- a/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml +++ b/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml @@ -1,7 +1,7 @@ apiVersion: compute.functionmesh.io/v1alpha1 kind: FunctionMesh metadata: - name: functionmesh-generic-resources-sample + name: functionmesh-generic-sample spec: genericResources: - apiVersion: "compute.functionmesh.io/v1alpha1" diff --git a/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh b/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh index f06e96324..a88fae06f 100644 --- a/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh +++ b/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh @@ -36,21 +36,21 @@ manifests_file="${BASE_DIR}"/.ci/tests/integration/cases/functionmesh-with-gener kubectl apply -f "${manifests_file}" > /dev/null 2>&1 -verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-java-function 2>&1) +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-sample-java-function 2>&1) if [ $? -ne 0 ]; then echo "$verify_fm_result" kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true exit 1 fi -verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-golang-function 2>&1) +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-sample-golang-function 2>&1) if [ $? -ne 0 ]; then echo "$verify_fm_result" kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true exit 1 fi -verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-python-function 2>&1) +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-sample-python-function 2>&1) if [ $? -ne 0 ]; then echo "$verify_fm_result" kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true diff --git a/.ci/tests/integration/e2e_with_tls.yaml b/.ci/tests/integration/e2e_with_tls.yaml index e1844caf3..8ea255a8b 100644 --- a/.ci/tests/integration/e2e_with_tls.yaml +++ b/.ci/tests/integration/e2e_with_tls.yaml @@ -131,3 +131,5 @@ verify: expected: expected.data.yaml - query: timeout 5m bash .ci/tests/integration/cases/global-and-namespaced-config/verify.sh expected: expected.data.yaml + - query: timeout 5m bash .ci/tests/integration/cases/functionmesh-generic-resources/verify.sh + expected: expected.data.yaml diff --git a/controllers/function_mesh.go b/controllers/function_mesh.go index f18e733ec..a6bd11f32 100644 --- a/controllers/function_mesh.go +++ b/controllers/function_mesh.go @@ -251,7 +251,7 @@ func (r *FunctionMeshReconciler) observeGenericResources(ctx context.Context, me condition, ok := mesh.Status.GenericResourceConditions[resource.Name] if !ok { mesh.Status.GenericResourceConditions[resource.Name] = v1alpha1.ResourceCondition{ - Condition: v1alpha1.SinkReady, + Condition: v1alpha1.GenericResourceReady, Status: metav1.ConditionFalse, Action: v1alpha1.Create, ApiVersion: resource.APIVersion, diff --git a/controllers/functionmesh_controller.go b/controllers/functionmesh_controller.go index e4b72d69f..2ecea79f9 100644 --- a/controllers/functionmesh_controller.go +++ b/controllers/functionmesh_controller.go @@ -72,6 +72,9 @@ func (r *FunctionMeshReconciler) Reconcile(ctx context.Context, req ctrl.Request if mesh.Status.SinkConditions == nil { mesh.Status.SinkConditions = make(map[string]v1alpha1.ResourceCondition) } + if mesh.Status.GenericResourceConditions == nil { + mesh.Status.GenericResourceConditions = make(map[string]v1alpha1.ResourceCondition) + } if mesh.Status.Condition == nil { mesh.Status.Condition = &v1alpha1.ResourceCondition{} } diff --git a/controllers/spec/common.go b/controllers/spec/common.go index d4ea8c5dc..55c624a57 100644 --- a/controllers/spec/common.go +++ b/controllers/spec/common.go @@ -39,6 +39,7 @@ import ( autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" v1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -2058,7 +2059,7 @@ func CheckIfStatefulSetSpecIsEqual(spec *appsv1.StatefulSetSpec, desiredSpec *ap container.ImagePullPolicy != desiredContainer.ImagePullPolicy || !reflect.DeepEqual(ports, desiredPorts) || !reflect.DeepEqual(containerEnvFrom, desiredContainerEnvFrom) || - !reflect.DeepEqual(container.Resources, desiredContainer.Resources) { + !equality.Semantic.DeepEqual(container.Resources, desiredContainer.Resources) { return false } From 733549196761fb822aa86ddb1d5c12cc9f6e677a Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Sat, 11 May 2024 14:46:07 +0800 Subject: [PATCH 5/6] Fix test --- .ci/tests/integration/e2e_with_tls.yaml | 2 +- api/compute/v1alpha1/common.go | 2 +- controllers/function_mesh.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/tests/integration/e2e_with_tls.yaml b/.ci/tests/integration/e2e_with_tls.yaml index 8ea255a8b..f114aa895 100644 --- a/.ci/tests/integration/e2e_with_tls.yaml +++ b/.ci/tests/integration/e2e_with_tls.yaml @@ -131,5 +131,5 @@ verify: expected: expected.data.yaml - query: timeout 5m bash .ci/tests/integration/cases/global-and-namespaced-config/verify.sh expected: expected.data.yaml - - query: timeout 5m bash .ci/tests/integration/cases/functionmesh-generic-resources/verify.sh + - query: timeout 5m bash .ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh expected: expected.data.yaml diff --git a/api/compute/v1alpha1/common.go b/api/compute/v1alpha1/common.go index b85bbadbf..8fcd102b5 100644 --- a/api/compute/v1alpha1/common.go +++ b/api/compute/v1alpha1/common.go @@ -372,7 +372,7 @@ type ResourceCondition struct { Condition ResourceConditionType `json:"condition,omitempty"` Status metav1.ConditionStatus `json:"status,omitempty"` Action ReconcileAction `json:"action,omitempty"` - ApiVersion string `json:"apiVersion,omitempty"` + APIVersion string `json:"apiVersion,omitempty"` Kind string `json:"kind,omitempty"` } diff --git a/controllers/function_mesh.go b/controllers/function_mesh.go index a6bd11f32..79a498e45 100644 --- a/controllers/function_mesh.go +++ b/controllers/function_mesh.go @@ -254,7 +254,7 @@ func (r *FunctionMeshReconciler) observeGenericResources(ctx context.Context, me Condition: v1alpha1.GenericResourceReady, Status: metav1.ConditionFalse, Action: v1alpha1.Create, - ApiVersion: resource.APIVersion, + APIVersion: resource.APIVersion, Kind: resource.Kind, } continue @@ -508,7 +508,7 @@ func (r *FunctionMeshReconciler) UpdateFunctionMesh(ctx context.Context, req ctr if resourceCondition.Condition == v1alpha1.Orphaned { // clean up the orphaned generic resource obj := &unstructured.Unstructured{} - obj.SetAPIVersion(resourceCondition.ApiVersion) + obj.SetAPIVersion(resourceCondition.APIVersion) obj.SetKind(resourceCondition.Kind) if err := r.Get(ctx, types.NamespacedName{ Namespace: mesh.Namespace, From 59cee7999a3ad5f066c7938f7c496503e619c53d Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Sat, 11 May 2024 17:50:20 +0800 Subject: [PATCH 6/6] Fix ci --- .ci/tests/integration/e2e.yaml | 2 ++ .ci/tests/integration/e2e_with_tls.yaml | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/tests/integration/e2e.yaml b/.ci/tests/integration/e2e.yaml index ed4020639..908624c7b 100644 --- a/.ci/tests/integration/e2e.yaml +++ b/.ci/tests/integration/e2e.yaml @@ -122,6 +122,8 @@ verify: expected: expected.data.yaml - query: timeout 5m bash .ci/tests/integration/cases/functionmesh/verify.sh expected: expected.data.yaml + - query: timeout 5m bash .ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh + expected: expected.data.yaml - query: timeout 5m bash .ci/tests/integration/cases/hpa/verify.sh expected: expected.data.yaml - query: timeout 5m bash .ci/tests/integration/cases/builtin-hpa/verify.sh diff --git a/.ci/tests/integration/e2e_with_tls.yaml b/.ci/tests/integration/e2e_with_tls.yaml index f114aa895..e1844caf3 100644 --- a/.ci/tests/integration/e2e_with_tls.yaml +++ b/.ci/tests/integration/e2e_with_tls.yaml @@ -131,5 +131,3 @@ verify: expected: expected.data.yaml - query: timeout 5m bash .ci/tests/integration/cases/global-and-namespaced-config/verify.sh expected: expected.data.yaml - - query: timeout 5m bash .ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh - expected: expected.data.yaml