Dapr Kubernetes Operator CRDs should be cluster scope #180
Signed-off-by: Luca Burgazzoli <lburgazzoli@gmail.com>
This commit is contained in:
parent
236cdd1f18
commit
e000c9b2da
19
PROJECT
19
PROJECT
|
@ -11,27 +11,16 @@ repo: github.com/dapr/kubernetes-operator
|
|||
resources:
|
||||
- api:
|
||||
crdVersion: v1
|
||||
namespaced: true
|
||||
controller: true
|
||||
domain: dapr.io
|
||||
group: operator
|
||||
kind: DaprControlPlane
|
||||
path: github.com/dapr/kubernetes-operator/api/operator/v1alpha1
|
||||
version: v1alpha1
|
||||
- api:
|
||||
crdVersion: v1
|
||||
namespaced: true
|
||||
domain: dapr.io
|
||||
group: operator
|
||||
kind: DaprInstance
|
||||
path: github.com/dapr/kubernetes-operator/api/operator/v1alpha1
|
||||
version: v1alpha1
|
||||
path: github.com/dapr/kubernetes-operator/api/operator/v1beta1
|
||||
version: v1beta1
|
||||
- api:
|
||||
crdVersion: v1
|
||||
namespaced: true
|
||||
domain: dapr.io
|
||||
group: operator
|
||||
kind: DaprCruiseControl
|
||||
path: github.com/dapr/kubernetes-operator/api/operator/v1alpha1
|
||||
version: v1alpha1
|
||||
path: github.com/dapr/kubernetes-operator/api/operator/v1beta1
|
||||
version: v1beta1
|
||||
version: "3"
|
||||
|
|
15
README.md
15
README.md
|
@ -42,7 +42,7 @@ Kubernetes cluster.
|
|||
The following example shows the most minimal valid manifest to create a new Dapr instance:
|
||||
|
||||
```yaml
|
||||
apiVersion: operator.dapr.io/v1alpha1
|
||||
apiVersion: operator.dapr.io/v1beta1
|
||||
kind: DaprInstance
|
||||
metadata:
|
||||
name: "dapr-instance"
|
||||
|
@ -50,16 +50,6 @@ spec:
|
|||
values: {}
|
||||
```
|
||||
|
||||
```yaml
|
||||
# Deprecated, use DaprInstance instead
|
||||
apiVersion: operator.dapr.io/v1alpha1
|
||||
kind: DaprControlPlane
|
||||
metadata:
|
||||
name: "dapr-control-plane"
|
||||
spec:
|
||||
values: {}
|
||||
```
|
||||
|
||||
The `DaprInstance` resource is a Kubernetes Custom Resource (CRD) that describes the desired state for a given Dapr instance and allows for the configuration of the components that make up the instance.
|
||||
|
||||
When the `Dapr Kubernetes Operator` sees a new `DaprInstance` resource, the Dapr components are provisioned using Kubernetes resources generated from the official [Dapr Helm Charts](https://github.com/dapr/helm-charts) and managed by the operator.
|
||||
|
@ -67,8 +57,7 @@ This means that the same configuration option that are available when [installin
|
|||
When something changes on an existing `DaprInstance` resource or any resource generated by the operator, the operator works to reconfigure the cluster to ensure the actual state of the cluster matches the desired state.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The operator expect that a single `DaprInstance` named `dapr-instance` and placed in the same namespace where the operator runs exists at a given point in time.
|
||||
> Any additional `DaprInstance` resources will be moved to an `Error` state and ignored.
|
||||
> The operator expect that a single cluster wide `DaprInstance` named `dapr-instance`.
|
||||
|
||||
The `DaprInstance` Custom Resource consists of the following properties
|
||||
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"github.com/dapr/kubernetes-operator/pkg/conditions"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type DaprControlPlaneSpec struct {
|
||||
// +kubebuilder:validation:Optional
|
||||
Values *JSON `json:"values"`
|
||||
}
|
||||
|
||||
type DaprControlPlaneStatus struct {
|
||||
Status `json:",inline"`
|
||||
Chart *ChartMeta `json:"chart,omitempty"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`,description="Ready"
|
||||
// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`,description="Reason"
|
||||
// +kubebuilder:printcolumn:name="Chart Name",type=string,JSONPath=`.status.chart.name`,description="Chart Name"
|
||||
// +kubebuilder:printcolumn:name="Chart Repo",type=string,JSONPath=`.status.chart.repo`,description="Chart Repo"
|
||||
// +kubebuilder:printcolumn:name="Chart Version",type=string,JSONPath=`.status.chart.version`,description="Chart Version"
|
||||
// +kubebuilder:resource:path=daprcontrolplanes,scope=Namespaced,shortName=dcp,categories=dapr
|
||||
// +kubebuilder:deprecatedversion:warning="v1alpha1.DaprControlPlane is deprecated, please, use v1alpha1.DaprInstance instead"
|
||||
|
||||
type DaprControlPlane struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec DaprControlPlaneSpec `json:"spec,omitempty"`
|
||||
Status DaprControlPlaneStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (in *DaprControlPlane) GetStatus() *Status {
|
||||
return &in.Status.Status
|
||||
}
|
||||
|
||||
func (in *DaprControlPlane) GetConditions() conditions.Conditions {
|
||||
return in.Status.Conditions
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
type DaprControlPlaneList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []DaprControlPlane `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&DaprControlPlane{}, &DaprControlPlaneList{})
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
// Package v1alpha1 contains API Schema definitions for the operator.dapr.io API group.
|
||||
//
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=operator.dapr.io
|
||||
|
||||
package v1alpha1
|
|
@ -13,7 +13,7 @@ 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.
|
||||
*/
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"github.com/dapr/kubernetes-operator/pkg/conditions"
|
||||
|
@ -32,6 +32,7 @@ type DaprCruiseControlStatus struct {
|
|||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:storageversion
|
||||
|
@ -40,7 +41,8 @@ type DaprCruiseControlStatus struct {
|
|||
// +kubebuilder:printcolumn:name="Chart Name",type=string,JSONPath=`.status.chart.name`,description="Chart Name"
|
||||
// +kubebuilder:printcolumn:name="Chart Repo",type=string,JSONPath=`.status.chart.repo`,description="Chart Repo"
|
||||
// +kubebuilder:printcolumn:name="Chart Version",type=string,JSONPath=`.status.chart.version`,description="Chart Version"
|
||||
// +kubebuilder:resource:path=daprcruiscontrols,scope=Namespaced,shortName=dcc,categories=dapr
|
||||
// +kubebuilder:resource:path=daprcruiscontrols,scope=Cluster,shortName=dcc,categories=dapr
|
||||
// +kubebuilder:validation:XValidation:rule="self.metadata.name == 'dapr-cruise-control'",message="DaprCruiseControl name must be dapr-cruise-control"
|
||||
|
||||
// DaprCruiseControl is the Schema for the daprcruisecontrols API.
|
||||
type DaprCruiseControl struct {
|
|
@ -14,15 +14,23 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"github.com/dapr/kubernetes-operator/pkg/conditions"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type DeploymentSpec struct {
|
||||
// +kubebuilder:validation:Required
|
||||
// Namespace represent the target namespace where the Dapr resources will be installed
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// DaprInstanceSpec defines the desired state of DaprInstance.
|
||||
type DaprInstanceSpec struct {
|
||||
Deployment DeploymentSpec `json:"deployment"`
|
||||
|
||||
// +kubebuilder:validation:Optional
|
||||
Chart *ChartSpec `json:"chart,omitempty"`
|
||||
|
||||
|
@ -37,6 +45,7 @@ type DaprInstanceStatus struct {
|
|||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:storageversion
|
||||
|
@ -45,7 +54,8 @@ type DaprInstanceStatus struct {
|
|||
// +kubebuilder:printcolumn:name="Chart Name",type=string,JSONPath=`.status.chart.name`,description="Chart Name"
|
||||
// +kubebuilder:printcolumn:name="Chart Repo",type=string,JSONPath=`.status.chart.repo`,description="Chart Repo"
|
||||
// +kubebuilder:printcolumn:name="Chart Version",type=string,JSONPath=`.status.chart.version`,description="Chart Version"
|
||||
// +kubebuilder:resource:path=daprinstances,scope=Namespaced,shortName=di,categories=dapr
|
||||
// +kubebuilder:resource:path=daprinstances,scope=Cluster,shortName=di,categories=dapr
|
||||
// +kubebuilder:validation:XValidation:rule="self.metadata.name == 'dapr-instance'",message="DaprInstance name must be dapr-instance"
|
||||
|
||||
// DaprInstance is the Schema for the daprinstances API.
|
||||
type DaprInstance struct {
|
|
@ -0,0 +1,7 @@
|
|||
// Package v1beta1 contains API Schema definitions for the operator.dapr.io API group.
|
||||
//
|
||||
// +k8s:openapi-gen=true
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=operator.dapr.io
|
||||
|
||||
package v1beta1
|
|
@ -14,10 +14,12 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1alpha1 contains API Schema definitions for the tools v1alpha1 API group
|
||||
// Package v1beta1 contains API Schema definitions for the tools v1beta1 API group
|
||||
//
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=operator.dapr.io
|
||||
package v1alpha1
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"github.com/dapr/kubernetes-operator/api/operator"
|
||||
|
@ -27,7 +29,7 @@ import (
|
|||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects.
|
||||
GroupVersion = schema.GroupVersion{Group: operator.Group, Version: "v1alpha1"}
|
||||
GroupVersion = schema.GroupVersion{Group: operator.Group, Version: "v1beta1"}
|
||||
|
||||
// SchemeGroupVersion is an hack for client gen.
|
||||
SchemeGroupVersion = GroupVersion
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -55,106 +55,6 @@ func (in *ChartSpec) DeepCopy() *ChartSpec {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DaprControlPlane) DeepCopyInto(out *DaprControlPlane) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaprControlPlane.
|
||||
func (in *DaprControlPlane) DeepCopy() *DaprControlPlane {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DaprControlPlane)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DaprControlPlane) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DaprControlPlaneList) DeepCopyInto(out *DaprControlPlaneList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]DaprControlPlane, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaprControlPlaneList.
|
||||
func (in *DaprControlPlaneList) DeepCopy() *DaprControlPlaneList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DaprControlPlaneList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DaprControlPlaneList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DaprControlPlaneSpec) DeepCopyInto(out *DaprControlPlaneSpec) {
|
||||
*out = *in
|
||||
if in.Values != nil {
|
||||
in, out := &in.Values, &out.Values
|
||||
*out = new(JSON)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaprControlPlaneSpec.
|
||||
func (in *DaprControlPlaneSpec) DeepCopy() *DaprControlPlaneSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DaprControlPlaneSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DaprControlPlaneStatus) DeepCopyInto(out *DaprControlPlaneStatus) {
|
||||
*out = *in
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
if in.Chart != nil {
|
||||
in, out := &in.Chart, &out.Chart
|
||||
*out = new(ChartMeta)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaprControlPlaneStatus.
|
||||
func (in *DaprControlPlaneStatus) DeepCopy() *DaprControlPlaneStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DaprControlPlaneStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DaprCruiseControl) DeepCopyInto(out *DaprCruiseControl) {
|
||||
*out = *in
|
||||
|
@ -312,6 +212,7 @@ func (in *DaprInstanceList) DeepCopyObject() runtime.Object {
|
|||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DaprInstanceSpec) DeepCopyInto(out *DaprInstanceSpec) {
|
||||
*out = *in
|
||||
out.Deployment = in.Deployment
|
||||
if in.Chart != nil {
|
||||
in, out := &in.Chart, &out.Chart
|
||||
*out = new(ChartSpec)
|
||||
|
@ -355,6 +256,21 @@ func (in *DaprInstanceStatus) DeepCopy() *DaprInstanceStatus {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeploymentSpec) DeepCopyInto(out *DeploymentSpec) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentSpec.
|
||||
func (in *DeploymentSpec) DeepCopy() *DeploymentSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeploymentSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *JSON) DeepCopyInto(out *JSON) {
|
||||
*out = *in
|
|
@ -3,24 +3,25 @@ package run
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/controlplane"
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/instance"
|
||||
"github.com/dapr/kubernetes-operator/pkg/helm"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
admregv1 "k8s.io/api/admissionregistration/v1"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
policyv1 "k8s.io/api/policy/v1"
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
ctrlRt "sigs.k8s.io/controller-runtime"
|
||||
rtcache "sigs.k8s.io/controller-runtime/pkg/cache"
|
||||
rtclient "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
|
||||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/instance"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
"github.com/dapr/kubernetes-operator/pkg/helm"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -52,12 +53,9 @@ func NewCmd() *cobra.Command {
|
|||
}
|
||||
|
||||
co.WatchSelectors = selector
|
||||
co.Logger = ctrlRt.Log.WithName("controller")
|
||||
|
||||
return controller.Start(co, func(manager manager.Manager, opts controller.Options) error {
|
||||
if _, err := controlplane.NewReconciler(cmd.Context(), manager, helmOpts); err != nil {
|
||||
return fmt.Errorf("unable to set-up DaprControlPlane reconciler: %w", err)
|
||||
}
|
||||
|
||||
if _, err := instance.NewReconciler(cmd.Context(), manager, helmOpts); err != nil {
|
||||
return fmt.Errorf("unable to set-up DaprInstance reconciler: %w", err)
|
||||
}
|
||||
|
@ -103,17 +101,18 @@ func computeListWatch() (map[rtclient.Object]rtcache.ByObject, error) {
|
|||
}
|
||||
|
||||
selectors := map[rtclient.Object]rtcache.ByObject{
|
||||
// k8s
|
||||
&admregv1.MutatingWebhookConfiguration{}: {Label: selector},
|
||||
&appsv1.StatefulSet{}: {Label: selector},
|
||||
&appsv1.Deployment{}: {Label: selector},
|
||||
&corev1.Secret{}: {Label: selector},
|
||||
&corev1.ConfigMap{}: {Label: selector},
|
||||
&corev1.Service{}: {Label: selector},
|
||||
&corev1.ServiceAccount{}: {Label: selector},
|
||||
&policyv1.PodDisruptionBudget{}: {Label: selector},
|
||||
&rbacv1.ClusterRole{}: {Label: selector},
|
||||
&rbacv1.ClusterRoleBinding{}: {Label: selector},
|
||||
&rbacv1.Role{}: {Label: selector},
|
||||
&rbacv1.RoleBinding{}: {Label: selector},
|
||||
&admregv1.MutatingWebhookConfiguration{}: {Label: selector},
|
||||
&corev1.Secret{}: {Label: selector},
|
||||
&corev1.Service{}: {Label: selector},
|
||||
&corev1.ServiceAccount{}: {Label: selector},
|
||||
&appsv1.StatefulSet{}: {Label: selector},
|
||||
&appsv1.Deployment{}: {Label: selector},
|
||||
}
|
||||
|
||||
return selectors, nil
|
||||
|
|
|
@ -1,153 +0,0 @@
|
|||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.16.3
|
||||
name: daprcontrolplanes.operator.dapr.io
|
||||
spec:
|
||||
group: operator.dapr.io
|
||||
names:
|
||||
categories:
|
||||
- dapr
|
||||
kind: DaprControlPlane
|
||||
listKind: DaprControlPlaneList
|
||||
plural: daprcontrolplanes
|
||||
shortNames:
|
||||
- dcp
|
||||
singular: daprcontrolplane
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- additionalPrinterColumns:
|
||||
- description: Ready
|
||||
jsonPath: .status.conditions[?(@.type=="Ready")].status
|
||||
name: Ready
|
||||
type: string
|
||||
- description: Reason
|
||||
jsonPath: .status.conditions[?(@.type=="Ready")].reason
|
||||
name: Reason
|
||||
type: string
|
||||
- description: Chart Name
|
||||
jsonPath: .status.chart.name
|
||||
name: Chart Name
|
||||
type: string
|
||||
- description: Chart Repo
|
||||
jsonPath: .status.chart.repo
|
||||
name: Chart Repo
|
||||
type: string
|
||||
- description: Chart Version
|
||||
jsonPath: .status.chart.version
|
||||
name: Chart Version
|
||||
type: string
|
||||
deprecated: true
|
||||
deprecationWarning: v1alpha1.DaprControlPlane is deprecated, please, use v1alpha1.DaprInstance
|
||||
instead
|
||||
name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
properties:
|
||||
apiVersion:
|
||||
description: |-
|
||||
APIVersion defines the versioned schema of this representation of an object.
|
||||
Servers should convert recognized schemas to the latest internal value, and
|
||||
may reject unrecognized values.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
||||
type: string
|
||||
kind:
|
||||
description: |-
|
||||
Kind is a string value representing the REST resource this object represents.
|
||||
Servers may infer this from the endpoint the client submits requests to.
|
||||
Cannot be updated.
|
||||
In CamelCase.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
properties:
|
||||
values:
|
||||
description: |-
|
||||
JSON represents any valid JSON value.
|
||||
These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
status:
|
||||
properties:
|
||||
chart:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
repo:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
type: object
|
||||
conditions:
|
||||
items:
|
||||
description: Condition contains details for one aspect of the current
|
||||
state of this API Resource.
|
||||
properties:
|
||||
lastTransitionTime:
|
||||
description: |-
|
||||
lastTransitionTime is the last time the condition transitioned from one status to another.
|
||||
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
|
||||
format: date-time
|
||||
type: string
|
||||
message:
|
||||
description: |-
|
||||
message is a human readable message indicating details about the transition.
|
||||
This may be an empty string.
|
||||
maxLength: 32768
|
||||
type: string
|
||||
observedGeneration:
|
||||
description: |-
|
||||
observedGeneration represents the .metadata.generation that the condition was set based upon.
|
||||
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
|
||||
with respect to the current state of the instance.
|
||||
format: int64
|
||||
minimum: 0
|
||||
type: integer
|
||||
reason:
|
||||
description: |-
|
||||
reason contains a programmatic identifier indicating the reason for the condition's last transition.
|
||||
Producers of specific condition types may define expected values and meanings for this field,
|
||||
and whether the values are considered a guaranteed API.
|
||||
The value should be a CamelCase string.
|
||||
This field may not be empty.
|
||||
maxLength: 1024
|
||||
minLength: 1
|
||||
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
|
||||
type: string
|
||||
status:
|
||||
description: status of the condition, one of True, False, Unknown.
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
type: string
|
||||
type:
|
||||
description: type of condition in CamelCase or in foo.example.com/CamelCase.
|
||||
maxLength: 316
|
||||
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
|
||||
type: string
|
||||
required:
|
||||
- lastTransitionTime
|
||||
- message
|
||||
- reason
|
||||
- status
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
observedGeneration:
|
||||
format: int64
|
||||
type: integer
|
||||
phase:
|
||||
type: string
|
||||
required:
|
||||
- phase
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
|
@ -16,7 +16,7 @@ spec:
|
|||
shortNames:
|
||||
- dcc
|
||||
singular: daprcruisecontrol
|
||||
scope: Namespaced
|
||||
scope: Cluster
|
||||
versions:
|
||||
- additionalPrinterColumns:
|
||||
- description: Ready
|
||||
|
@ -39,7 +39,7 @@ spec:
|
|||
jsonPath: .status.chart.version
|
||||
name: Chart Version
|
||||
type: string
|
||||
name: v1alpha1
|
||||
name: v1beta1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: DaprCruiseControl is the Schema for the daprcruisecontrols API.
|
||||
|
@ -141,6 +141,9 @@ spec:
|
|||
- phase
|
||||
type: object
|
||||
type: object
|
||||
x-kubernetes-validations:
|
||||
- message: DaprCruiseControl name must be dapr-cruise-control
|
||||
rule: self.metadata.name == 'dapr-cruise-control'
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
|
|
|
@ -16,7 +16,7 @@ spec:
|
|||
shortNames:
|
||||
- di
|
||||
singular: daprinstance
|
||||
scope: Namespaced
|
||||
scope: Cluster
|
||||
versions:
|
||||
- additionalPrinterColumns:
|
||||
- description: Ready
|
||||
|
@ -39,7 +39,7 @@ spec:
|
|||
jsonPath: .status.chart.version
|
||||
name: Chart Version
|
||||
type: string
|
||||
name: v1alpha1
|
||||
name: v1beta1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: DaprInstance is the Schema for the daprinstances API.
|
||||
|
@ -77,11 +77,22 @@ spec:
|
|||
version:
|
||||
type: string
|
||||
type: object
|
||||
deployment:
|
||||
properties:
|
||||
namespace:
|
||||
description: Namespace represent the target namespace where the
|
||||
Dapr resources will be installed
|
||||
type: string
|
||||
required:
|
||||
- namespace
|
||||
type: object
|
||||
values:
|
||||
description: |-
|
||||
JSON represents any valid JSON value.
|
||||
These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- deployment
|
||||
type: object
|
||||
status:
|
||||
description: DaprInstanceStatus defines the observed state of DaprInstance.
|
||||
|
@ -160,6 +171,9 @@ spec:
|
|||
- phase
|
||||
type: object
|
||||
type: object
|
||||
x-kubernetes-validations:
|
||||
- message: DaprInstance name must be dapr-instance
|
||||
rule: self.metadata.name == 'dapr-instance'
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# since it depends on service name and namespace that are out of this kustomize package.
|
||||
# It should be run by config/default
|
||||
resources:
|
||||
- bases/operator.dapr.io_daprcontrolplanes.yaml
|
||||
- bases/operator.dapr.io_daprinstances.yaml
|
||||
- bases/operator.dapr.io_daprcruiscontrols.yaml
|
||||
#+kubebuilder:scaffold:crdkustomizeresource
|
||||
|
|
|
@ -16,22 +16,16 @@ spec:
|
|||
apiservicedefinitions: {}
|
||||
customresourcedefinitions:
|
||||
owned:
|
||||
- description: DaprControlPlane is the Schema for the Dapr ControlPlane API.
|
||||
displayName: DaprControlPlane
|
||||
kind: DaprControlPlane
|
||||
name: daprcontrolplanes.operator.dapr.io
|
||||
version: v1alpha1
|
||||
deprecated: true
|
||||
- description: DaprInstance is the Schema for the Dapr Instance API.
|
||||
displayName: DaprInstance
|
||||
kind: DaprInstance
|
||||
name: daprinstances.operator.dapr.io
|
||||
version: v1alpha1
|
||||
version: v1beta1
|
||||
- description: DaprCruiseControl is the Schema for the Dapr CruiseControl API.
|
||||
displayName: DaprCruiseControl
|
||||
kind: DaprCruiseControl
|
||||
name: daprcruisecontrols.operator.dapr.io
|
||||
version: v1alpha1
|
||||
version: v1beta1
|
||||
description: Dapr Control Plane Operator
|
||||
displayName: Dapr Control Plane Operator
|
||||
icon:
|
||||
|
|
|
@ -57,7 +57,6 @@ rules:
|
|||
- apiGroups:
|
||||
- operator.dapr.io
|
||||
resources:
|
||||
- daprcontrolplanes
|
||||
- daprinstances
|
||||
verbs:
|
||||
- create
|
||||
|
@ -70,14 +69,12 @@ rules:
|
|||
- apiGroups:
|
||||
- operator.dapr.io
|
||||
resources:
|
||||
- daprcontrolplanes/finalizers
|
||||
- daprinstances/finalizers
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- operator.dapr.io
|
||||
resources:
|
||||
- daprcontrolplanes/status
|
||||
- daprinstances/status
|
||||
verbs:
|
||||
- get
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: operator.dapr.io/v1alpha1
|
||||
apiVersion: operator.dapr.io/v1beta1
|
||||
kind: DaprInstance
|
||||
metadata:
|
||||
name: "dapr-instance"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
## Append samples of your project ##
|
||||
resources:
|
||||
- sample-daprcontrolplane.yaml
|
||||
- sample-daprinstance.yaml
|
||||
- sample-daprcruisecontrol.yaml
|
||||
#+kubebuilder:scaffold:manifestskustomizesamples
|
||||
|
|
|
@ -4,7 +4,7 @@ metadata:
|
|||
name: dapr-control-plane
|
||||
namespace: dapr-system
|
||||
spec:
|
||||
channel: alpha
|
||||
channel: beta
|
||||
name: dapr-kubernetes-operator
|
||||
installPlanApproval: Automatic
|
||||
source: daprio-catalog
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
apiVersion: operator.dapr.io/v1alpha1
|
||||
kind: DaprControlPlane
|
||||
metadata:
|
||||
name: "dapr-control-plane"
|
||||
namespace: "dapr-system"
|
||||
spec:
|
||||
# This object provides access to values passed into the Dpr Helm chart
|
||||
values: {}
|
|
@ -1,6 +1,5 @@
|
|||
apiVersion: operator.dapr.io/v1alpha1
|
||||
apiVersion: operator.dapr.io/v1beta1
|
||||
kind: DaprCruiseControl
|
||||
metadata:
|
||||
name: "dapr-cruise-control"
|
||||
namespace: "dapr-system"
|
||||
spec: {}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
apiVersion: operator.dapr.io/v1alpha1
|
||||
apiVersion: operator.dapr.io/v1beta1
|
||||
kind: DaprInstance
|
||||
metadata:
|
||||
name: "dapr-instance"
|
||||
namespace: "dapr-system"
|
||||
spec:
|
||||
deployment:
|
||||
namespace: "dapr-system"
|
||||
# This object provides access to values passed into the Dpr Helm chart
|
||||
values: {}
|
||||
|
|
5
go.mod
5
go.mod
|
@ -14,7 +14,6 @@ require (
|
|||
github.com/operator-framework/operator-lifecycle-manager v0.22.0
|
||||
github.com/rs/xid v1.6.0
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/wI2L/jsondiff v0.6.0
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
|
||||
golang.org/x/time v0.6.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
|
@ -133,10 +132,6 @@ require (
|
|||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/spf13/cast v1.7.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/tidwall/gjson v1.17.1 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tidwall/sjson v1.2.5 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
|
|
12
go.sum
12
go.sum
|
@ -380,18 +380,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
|
|||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U=
|
||||
github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
||||
github.com/wI2L/jsondiff v0.6.0 h1:zrsH3FbfVa3JO9llxrcDy/XLkYPLgoMX6Mz3T2PP2AI=
|
||||
github.com/wI2L/jsondiff v0.6.0/go.mod h1:D6aQ5gKgPF9g17j+E9N7aasmU1O+XvfmWm1y8UMmNpw=
|
||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
|
|
|
@ -25,8 +25,8 @@ ${PROJECT_ROOT}/bin/kustomize build "${PROJECT_ROOT}/config/manifests" | ${PROJE
|
|||
--overwrite \
|
||||
--package "${BUNDLE_NAME}" \
|
||||
--version "${BUNDLE_VERSION}" \
|
||||
--channels "alpha" \
|
||||
--default-channel "alpha" \
|
||||
--channels "beta" \
|
||||
--default-channel "beta" \
|
||||
--output-dir "${BUNDLE_NAME}"
|
||||
|
||||
echo "Patch bundle metadata"
|
||||
|
|
|
@ -18,7 +18,7 @@ go run k8s.io/kube-openapi/cmd/openapi-gen \
|
|||
--output-file zz_generated.openapi.go \
|
||||
--output-dir "pkg/generated/openapi" \
|
||||
--output-pkg "github.com/dapr/kubernetes-operator/pkg/generated/openapi" \
|
||||
github.com/dapr/kubernetes-operator/api/operator/v1alpha1 \
|
||||
github.com/dapr/kubernetes-operator/api/operator/v1beta1 \
|
||||
k8s.io/apimachinery/pkg/apis/meta/v1 \
|
||||
k8s.io/apimachinery/pkg/runtime \
|
||||
k8s.io/apimachinery/pkg/version
|
||||
|
@ -29,14 +29,14 @@ go run k8s.io/code-generator/cmd/applyconfiguration-gen \
|
|||
--go-header-file="${PROJECT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir="${TMP_DIR}/client/applyconfiguration" \
|
||||
--output-pkg=github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration \
|
||||
github.com/dapr/kubernetes-operator/api/operator/v1alpha1
|
||||
github.com/dapr/kubernetes-operator/api/operator/v1beta1
|
||||
|
||||
echo "Generate client"
|
||||
go run k8s.io/code-generator/cmd/client-gen \
|
||||
--go-header-file="${PROJECT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir="${TMP_DIR}/client/clientset" \
|
||||
--input-base=github.com/dapr/kubernetes-operator/api \
|
||||
--input=operator/v1alpha1 \
|
||||
--input=operator/v1beta1 \
|
||||
--fake-clientset=false \
|
||||
--clientset-name "versioned" \
|
||||
--apply-configuration-package=github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration \
|
||||
|
@ -47,7 +47,7 @@ go run k8s.io/code-generator/cmd/lister-gen \
|
|||
--go-header-file="${PROJECT_ROOT}/hack/boilerplate.go.txt" \
|
||||
--output-dir="${TMP_DIR}/client/listers" \
|
||||
--output-pkg=github.com/dapr/kubernetes-operator/pkg/client/listers \
|
||||
github.com/dapr/kubernetes-operator/api/operator/v1alpha1
|
||||
github.com/dapr/kubernetes-operator/api/operator/v1beta1
|
||||
|
||||
echo "Generate informer"
|
||||
go run k8s.io/code-generator/cmd/informer-gen \
|
||||
|
@ -56,22 +56,19 @@ go run k8s.io/code-generator/cmd/informer-gen \
|
|||
--versioned-clientset-package=github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned \
|
||||
--listers-package=github.com/dapr/kubernetes-operator/pkg/client/listers \
|
||||
--output-pkg=github.com/dapr/kubernetes-operator/pkg/client/informers \
|
||||
github.com/dapr/kubernetes-operator/api/operator/v1alpha1
|
||||
github.com/dapr/kubernetes-operator/api/operator/v1beta1
|
||||
|
||||
# This should not be needed but for some reasons, the applyconfiguration-gen tool
|
||||
# sets a wrong APIVersion for the Dapr type (operator/v1alpha1 instead of the one with
|
||||
# the domain operator.dapr.io/v1alpha1).
|
||||
# sets a wrong APIVersion for the Dapr type (operator/v1beta1 instead of the one with
|
||||
# the domain operator.dapr.io/v1beta1).
|
||||
#
|
||||
# See: https://github.com/kubernetes/code-generator/issues/150
|
||||
sed -i \
|
||||
's/WithAPIVersion(\"operator\/v1alpha1\")/WithAPIVersion(\"operator.dapr.io\/v1alpha1\")/g' \
|
||||
"${TMP_DIR}"/client/applyconfiguration/operator/v1alpha1/daprcontrolplane.go
|
||||
's/WithAPIVersion(\"operator\/v1beta1\")/WithAPIVersion(\"operator.dapr.io\/v1beta1\")/g' \
|
||||
"${TMP_DIR}"/client/applyconfiguration/operator/v1beta1/daprinstance.go
|
||||
sed -i \
|
||||
's/WithAPIVersion(\"operator\/v1alpha1\")/WithAPIVersion(\"operator.dapr.io\/v1alpha1\")/g' \
|
||||
"${TMP_DIR}"/client/applyconfiguration/operator/v1alpha1/daprinstance.go
|
||||
sed -i \
|
||||
's/WithAPIVersion(\"operator\/v1alpha1\")/WithAPIVersion(\"operator.dapr.io\/v1alpha1\")/g' \
|
||||
"${TMP_DIR}"/client/applyconfiguration/operator/v1alpha1/daprcruisecontrol.go
|
||||
's/WithAPIVersion(\"operator\/v1beta1\")/WithAPIVersion(\"operator.dapr.io\/v1beta1\")/g' \
|
||||
"${TMP_DIR}"/client/applyconfiguration/operator/v1beta1/daprcruisecontrol.go
|
||||
|
||||
cp -r \
|
||||
"${TMP_DIR}"/client/* \
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
|
||||
package controlplane
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"k8s.io/client-go/tools/record"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/client"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/reconciler"
|
||||
"github.com/dapr/kubernetes-operator/pkg/helm"
|
||||
"github.com/go-logr/logr"
|
||||
|
||||
ctrlRt "sigs.k8s.io/controller-runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime/pkg/controller"
|
||||
)
|
||||
|
||||
func NewReconciler(ctx context.Context, manager ctrlRt.Manager, o helm.Options) (*Reconciler, error) {
|
||||
c, err := client.NewClient(manager.GetConfig(), manager.GetScheme(), manager.GetClient())
|
||||
if err != nil {
|
||||
//nolint:wrapcheck
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rec := Reconciler{}
|
||||
rec.l = ctrlRt.Log.WithName("dapr-controlplane-controller")
|
||||
rec.client = c
|
||||
rec.Scheme = manager.GetScheme()
|
||||
rec.manager = manager
|
||||
rec.recorder = manager.GetEventRecorderFor(controller.FieldManager)
|
||||
|
||||
rec.actions = append(rec.actions, NewApplyAction(rec.l))
|
||||
rec.actions = append(rec.actions, NewStatusAction(rec.l))
|
||||
|
||||
err = rec.init(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &rec, nil
|
||||
}
|
||||
|
||||
// +kubebuilder:rbac:groups=operator.dapr.io,resources=daprcontrolplanes,verbs=get;list;watch;create;update;patch;delete
|
||||
// +kubebuilder:rbac:groups=operator.dapr.io,resources=daprcontrolplanes/status,verbs=get;update;patch
|
||||
// +kubebuilder:rbac:groups=operator.dapr.io,resources=daprcontrolplanes/finalizers,verbs=update
|
||||
// +kubebuilder:rbac:groups=operator.dapr.io,resources=daprinstances,verbs=get;list;watch;create;update;patch;delete
|
||||
// +kubebuilder:rbac:groups=operator.dapr.io,resources=daprinstances/status,verbs=get
|
||||
|
||||
type Reconciler struct {
|
||||
client *client.Client
|
||||
Scheme *runtime.Scheme
|
||||
actions []Action
|
||||
l logr.Logger
|
||||
manager ctrlRt.Manager
|
||||
controller ctrl.Controller
|
||||
recorder record.EventRecorder
|
||||
}
|
||||
|
||||
func (r *Reconciler) Client() *client.Client {
|
||||
return r.client
|
||||
}
|
||||
|
||||
func (r *Reconciler) init(ctx context.Context) error {
|
||||
c := ctrlRt.NewControllerManagedBy(r.manager)
|
||||
|
||||
c = c.For(&daprApi.DaprControlPlane{}, builder.WithPredicates(
|
||||
predicate.Or(
|
||||
predicate.GenerationChangedPredicate{},
|
||||
)))
|
||||
|
||||
for i := range r.actions {
|
||||
b, err := r.actions[i].Configure(ctx, r.Client(), c)
|
||||
if err != nil {
|
||||
//nolint:wrapcheck
|
||||
return err
|
||||
}
|
||||
|
||||
c = b
|
||||
}
|
||||
|
||||
// by default, the controller expect the DaprControlPlane resource to be created
|
||||
// in the same namespace where it runs, if not fallback to the default namespace
|
||||
rec := reconciler.BaseReconciler[*daprApi.DaprControlPlane]{
|
||||
Delegate: r,
|
||||
Client: r.client,
|
||||
Log: log.FromContext(ctx),
|
||||
Name: DaprControlPlaneResourceName,
|
||||
Namespace: controller.OperatorNamespace(),
|
||||
FinalizerName: DaprControlPlaneFinalizerName,
|
||||
FinalizerAction: r.Cleanup,
|
||||
}
|
||||
|
||||
ct, err := c.Build(&rec)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failure building the application controller for DaprControlPlane resource: %w", err)
|
||||
}
|
||||
|
||||
r.controller = ct
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Reconciler) Event(object runtime.Object, eventType string, reason string, message string) {
|
||||
r.recorder.Event(
|
||||
object,
|
||||
eventType,
|
||||
reason,
|
||||
message,
|
||||
)
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package controlplane
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/resources"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/instance"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/client"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/predicates"
|
||||
"github.com/go-logr/logr"
|
||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
)
|
||||
|
||||
func NewApplyAction(l logr.Logger) Action {
|
||||
return &ApplyAction{
|
||||
l: l.WithName("action").WithName("apply"),
|
||||
subscriptions: make(map[string]struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
type ApplyAction struct {
|
||||
l logr.Logger
|
||||
subscriptions map[string]struct{}
|
||||
}
|
||||
|
||||
func (a *ApplyAction) Configure(_ context.Context, _ *client.Client, b *builder.Builder) (*builder.Builder, error) {
|
||||
b = b.Owns(&daprApi.DaprInstance{}, builder.WithPredicates(
|
||||
predicate.Or(
|
||||
predicate.GenerationChangedPredicate{},
|
||||
predicates.StatusChanged{},
|
||||
)))
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (a *ApplyAction) Run(ctx context.Context, rr *ReconciliationRequest) error {
|
||||
spec := daprAc.DaprInstanceSpec()
|
||||
|
||||
if rr.Resource.Spec.Values != nil {
|
||||
values := daprAc.JSON()
|
||||
values.RawMessage = rr.Resource.Spec.Values.RawMessage
|
||||
|
||||
spec = spec.WithValues(values)
|
||||
}
|
||||
|
||||
_, err := rr.Dapr.OperatorV1alpha1().DaprInstances(rr.Resource.Namespace).Apply(
|
||||
ctx,
|
||||
daprAc.DaprInstance(instance.DaprInstanceResourceName, rr.Resource.Namespace).
|
||||
WithOwnerReferences(resources.WithOwnerReference(rr.Resource)).
|
||||
WithSpec(spec),
|
||||
metav1.ApplyOptions{
|
||||
FieldManager: controller.FieldManager,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("failure to apply changes to %s: %w", rr.NamespacedName, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *ApplyAction) Cleanup(_ context.Context, _ *ReconciliationRequest) error {
|
||||
return nil
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package controlplane
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/instance"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/client"
|
||||
"github.com/go-logr/logr"
|
||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||
)
|
||||
|
||||
func NewStatusAction(l logr.Logger) Action {
|
||||
return &StatusAction{
|
||||
l: l.WithName("action").WithName("status"),
|
||||
}
|
||||
}
|
||||
|
||||
// StatusAction computes the state of a DaprControlPlane resource out of the owned DaprInstance resource.
|
||||
type StatusAction struct {
|
||||
l logr.Logger
|
||||
}
|
||||
|
||||
func (a *StatusAction) Configure(_ context.Context, _ *client.Client, b *builder.Builder) (*builder.Builder, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (a *StatusAction) Run(ctx context.Context, rr *ReconciliationRequest) error {
|
||||
di, err := rr.Dapr.OperatorV1alpha1().DaprInstances(rr.Resource.Namespace).Get(
|
||||
ctx,
|
||||
instance.DaprInstanceResourceName,
|
||||
metav1.GetOptions{},
|
||||
)
|
||||
|
||||
if err != nil && !k8serrors.IsNotFound(err) {
|
||||
return fmt.Errorf("failure to lookup resource %s: %w", rr.NamespacedName, err)
|
||||
}
|
||||
|
||||
for i := range di.Status.Conditions {
|
||||
meta.SetStatusCondition(&rr.Resource.Status.Conditions, di.Status.Conditions[i])
|
||||
}
|
||||
|
||||
rr.Resource.Status.Chart = di.Status.Chart
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *StatusAction) Cleanup(_ context.Context, _ *ReconciliationRequest) error {
|
||||
return nil
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
|
||||
package controlplane
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/conditions"
|
||||
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
)
|
||||
|
||||
func (r *Reconciler) reconciliationRequest(res *daprApi.DaprControlPlane) ReconciliationRequest {
|
||||
return ReconciliationRequest{
|
||||
Client: r.Client(),
|
||||
NamespacedName: types.NamespacedName{
|
||||
Name: res.Name,
|
||||
Namespace: res.Namespace,
|
||||
},
|
||||
Reconciler: r,
|
||||
Resource: res,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Reconciler) Reconcile(ctx context.Context, res *daprApi.DaprControlPlane) (ctrl.Result, error) {
|
||||
rr := r.reconciliationRequest(res)
|
||||
|
||||
l := log.FromContext(ctx)
|
||||
l.Info("Reconciling", "resource", rr.NamespacedName.String())
|
||||
|
||||
//
|
||||
// Reconcile
|
||||
//
|
||||
|
||||
reconcileCondition := metav1.Condition{
|
||||
Type: conditions.TypeReconciled,
|
||||
Status: metav1.ConditionTrue,
|
||||
Reason: conditions.ReasonReconciled,
|
||||
Message: conditions.ReasonReconciled,
|
||||
ObservedGeneration: rr.Resource.Generation,
|
||||
}
|
||||
|
||||
errs := make([]error, 0, len(r.actions)+1)
|
||||
|
||||
for i := range r.actions {
|
||||
if err := r.actions[i].Run(ctx, &rr); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
reconcileCondition.Status = metav1.ConditionFalse
|
||||
reconcileCondition.Reason = conditions.ReasonFailure
|
||||
reconcileCondition.Message = conditions.ReasonFailure
|
||||
|
||||
rr.Resource.Status.Phase = conditions.TypeError
|
||||
} else {
|
||||
rr.Resource.Status.ObservedGeneration = rr.Resource.Generation
|
||||
rr.Resource.Status.Phase = conditions.TypeReady
|
||||
}
|
||||
|
||||
meta.SetStatusCondition(&rr.Resource.Status.Conditions, reconcileCondition)
|
||||
|
||||
sort.SliceStable(rr.Resource.Status.Conditions, func(i, j int) bool {
|
||||
return rr.Resource.Status.Conditions[i].Type < rr.Resource.Status.Conditions[j].Type
|
||||
})
|
||||
|
||||
//
|
||||
// Update status
|
||||
//
|
||||
|
||||
err := r.Client().Status().Update(ctx, rr.Resource)
|
||||
if err != nil && k8serrors.IsConflict(err) {
|
||||
l.Info(err.Error())
|
||||
return ctrl.Result{Requeue: true}, nil
|
||||
} else if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
return ctrl.Result{}, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func (r *Reconciler) Cleanup(ctx context.Context, res *daprApi.DaprControlPlane) error {
|
||||
rr := r.reconciliationRequest(res)
|
||||
|
||||
l := log.FromContext(ctx)
|
||||
l.Info("Cleanup", "resource", rr.NamespacedName.String())
|
||||
|
||||
// Cleanup leftovers if needed
|
||||
for i := len(r.actions) - 1; i >= 0; i-- {
|
||||
if err := r.actions[i].Cleanup(ctx, &rr); err != nil {
|
||||
return fmt.Errorf("failure running cleanup action: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
package controlplane
|
|
@ -1,29 +0,0 @@
|
|||
package controlplane
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/client"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||
)
|
||||
|
||||
const (
|
||||
DaprControlPlaneFinalizerName = "controlplane.operator.dapr.io/finalizer"
|
||||
DaprControlPlaneResourceName = "dapr-control-plane"
|
||||
)
|
||||
|
||||
type ReconciliationRequest struct {
|
||||
*client.Client
|
||||
types.NamespacedName
|
||||
|
||||
Reconciler *Reconciler
|
||||
Resource *daprApi.DaprControlPlane
|
||||
}
|
||||
|
||||
type Action interface {
|
||||
Configure(ctx context.Context, c *client.Client, b *builder.Builder) (*builder.Builder, error)
|
||||
Run(ctx context.Context, rc *ReconciliationRequest) error
|
||||
Cleanup(ctx context.Context, rc *ReconciliationRequest) error
|
||||
}
|
|
@ -33,13 +33,12 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/client"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/reconciler"
|
||||
"github.com/dapr/kubernetes-operator/pkg/helm"
|
||||
"github.com/dapr/kubernetes-operator/pkg/openshift"
|
||||
"github.com/go-logr/logr"
|
||||
|
||||
ctrlRt "sigs.k8s.io/controller-runtime"
|
||||
|
@ -55,25 +54,14 @@ func NewReconciler(ctx context.Context, manager ctrlRt.Manager, o helm.Options)
|
|||
}
|
||||
|
||||
rec := Reconciler{}
|
||||
rec.l = ctrlRt.Log.WithName("dapr-instance-controller")
|
||||
rec.l = manager.GetLogger().WithName("instance")
|
||||
rec.client = c
|
||||
rec.Scheme = manager.GetScheme()
|
||||
rec.ClusterType = controller.ClusterTypeVanilla
|
||||
rec.manager = manager
|
||||
rec.recorder = manager.GetEventRecorderFor(controller.FieldManager)
|
||||
rec.helmOptions = o
|
||||
rec.helmEngine = helme.New()
|
||||
|
||||
isOpenshift, err := openshift.IsOpenShift(c.Discovery)
|
||||
if err != nil {
|
||||
//nolint:wrapcheck
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if isOpenshift {
|
||||
rec.ClusterType = controller.ClusterTypeOpenShift
|
||||
}
|
||||
|
||||
rec.actions = append(rec.actions, NewChartAction(rec.l))
|
||||
rec.actions = append(rec.actions, NewApplyCRDsAction(rec.l))
|
||||
rec.actions = append(rec.actions, NewApplyResourcesAction(rec.l))
|
||||
|
@ -122,7 +110,6 @@ func NewReconciler(ctx context.Context, manager ctrlRt.Manager, o helm.Options)
|
|||
type Reconciler struct {
|
||||
client *client.Client
|
||||
Scheme *runtime.Scheme
|
||||
ClusterType controller.ClusterType
|
||||
actions []Action
|
||||
l logr.Logger
|
||||
helmEngine *helme.Instance
|
||||
|
@ -161,7 +148,6 @@ func (r *Reconciler) init(ctx context.Context) error {
|
|||
Client: r.client,
|
||||
Log: log.FromContext(ctx),
|
||||
Name: DaprInstanceResourceName,
|
||||
Namespace: controller.OperatorNamespace(),
|
||||
FinalizerName: DaprInstanceFinalizerName,
|
||||
FinalizerAction: r.Cleanup,
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/gvks"
|
||||
ctrcli "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
|
@ -58,7 +61,6 @@ func (a *ApplyCRDsAction) Run(ctx context.Context, rc *ReconciliationRequest) er
|
|||
resources.Labels(&crd, map[string]string{
|
||||
helm.ReleaseGeneration: strconv.FormatInt(rc.Resource.Generation, 10),
|
||||
helm.ReleaseName: rc.Resource.Name,
|
||||
helm.ReleaseNamespace: rc.Resource.Namespace,
|
||||
helm.ReleaseVersion: c.Version(),
|
||||
})
|
||||
|
||||
|
@ -85,12 +87,17 @@ func (a *ApplyCRDsAction) Cleanup(_ context.Context, _ *ReconciliationRequest) e
|
|||
}
|
||||
|
||||
func (a *ApplyCRDsAction) apply(ctx context.Context, rc *ReconciliationRequest, crd *unstructured.Unstructured, apply bool) (bool, error) {
|
||||
dc, err := rc.Client.Dynamic(rc.Resource.Namespace, crd)
|
||||
dc, err := rc.Client.Dynamic(crd)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("cannot create dynamic client: %w", err)
|
||||
}
|
||||
|
||||
_, err = dc.Get(ctx, crd.GetName(), metav1.GetOptions{})
|
||||
// metadata only retrieval, no need to retrieve the entire CRD as we only need to check
|
||||
// for its existence
|
||||
p := metav1.PartialObjectMetadata{}
|
||||
p.SetGroupVersionKind(gvks.CustomResourceDefinition)
|
||||
|
||||
err = rc.Client.Get(ctx, ctrcli.ObjectKeyFromObject(crd), &p)
|
||||
if err != nil && !k8serrors.IsNotFound(err) {
|
||||
return false, fmt.Errorf("cannot determine if CRD %s exists: %w", resources.Ref(crd), err)
|
||||
}
|
||||
|
|
|
@ -6,6 +6,10 @@ import (
|
|||
"sort"
|
||||
"strconv"
|
||||
|
||||
ctrlCli "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/gvks"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/predicates"
|
||||
|
@ -15,14 +19,12 @@ import (
|
|||
corev1 "k8s.io/api/core/v1"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||
"sigs.k8s.io/controller-runtime/pkg/handler"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/client"
|
||||
"github.com/dapr/kubernetes-operator/pkg/helm"
|
||||
"github.com/dapr/kubernetes-operator/pkg/pointer"
|
||||
"github.com/dapr/kubernetes-operator/pkg/resources"
|
||||
)
|
||||
|
||||
|
@ -50,17 +52,20 @@ func (a *ApplyResourcesAction) Run(ctx context.Context, rc *ReconciliationReques
|
|||
return fmt.Errorf("cannot load chart: %w", err)
|
||||
}
|
||||
|
||||
items, err := c.Render(ctx, rc.Resource.Name, rc.Resource.Namespace, int(rc.Resource.Generation), rc.Helm.ChartValues)
|
||||
items, err := c.Render(
|
||||
ctx,
|
||||
rc.Resource.Name,
|
||||
rc.Resource.Spec.Deployment.Namespace,
|
||||
int(rc.Resource.Generation),
|
||||
rc.Helm.ChartValues,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot render a chart: %w", err)
|
||||
}
|
||||
|
||||
// TODO: this must be ordered by priority/relations
|
||||
sort.Slice(items, func(i int, j int) bool {
|
||||
istr := items[i].GroupVersionKind().Kind + ":" + items[i].GetName()
|
||||
jstr := items[j].GroupVersionKind().Kind + ":" + items[j].GetName()
|
||||
|
||||
return istr < jstr
|
||||
return resources.Ref(&items[i]) < resources.Ref(&items[j])
|
||||
})
|
||||
|
||||
force := rc.Resource.Generation != rc.Resource.Status.ObservedGeneration || !helm.IsSameChart(c, rc.Resource.Status.Chart)
|
||||
|
@ -82,18 +87,10 @@ func (a *ApplyResourcesAction) Run(ctx context.Context, rc *ReconciliationReques
|
|||
resources.Labels(&obj, map[string]string{
|
||||
helm.ReleaseGeneration: strconv.FormatInt(rc.Resource.Generation, 10),
|
||||
helm.ReleaseName: rc.Resource.Name,
|
||||
helm.ReleaseNamespace: rc.Resource.Namespace,
|
||||
helm.ReleaseVersion: c.Version(),
|
||||
})
|
||||
|
||||
gvk := obj.GroupVersionKind()
|
||||
|
||||
if !force {
|
||||
force = !a.installOnly(gvk)
|
||||
}
|
||||
|
||||
err = a.apply(ctx, rc, &obj, force)
|
||||
if err != nil {
|
||||
if err = a.apply(ctx, rc, &obj, force || !a.installOnly(&obj)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -101,122 +98,37 @@ func (a *ApplyResourcesAction) Run(ctx context.Context, rc *ReconciliationReques
|
|||
return nil
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) Cleanup(ctx context.Context, rc *ReconciliationRequest) error {
|
||||
c, err := rc.Chart(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot load chart: %w", err)
|
||||
}
|
||||
|
||||
items, err := c.Render(ctx, rc.Resource.Name, rc.Resource.Namespace, int(rc.Resource.Generation), rc.Helm.ChartValues)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot render a chart: %w", err)
|
||||
}
|
||||
|
||||
for i := range items {
|
||||
obj := items[i]
|
||||
|
||||
dc, err := rc.Client.Dynamic(rc.Resource.Namespace, &obj)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot create dynamic client: %w", err)
|
||||
}
|
||||
|
||||
// Delete clustered resources
|
||||
if _, ok := dc.(*client.ClusteredResource); ok {
|
||||
err := dc.Delete(ctx, obj.GetName(), metav1.DeleteOptions{
|
||||
PropagationPolicy: pointer.Any(metav1.DeletePropagationForeground),
|
||||
})
|
||||
|
||||
if err != nil && !k8serrors.IsNotFound(err) {
|
||||
return fmt.Errorf("cannot delete object %s: %w", resources.Ref(&obj), err)
|
||||
}
|
||||
|
||||
a.l.Info("delete", "ref", resources.Ref(&obj))
|
||||
}
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) Cleanup(_ context.Context, _ *ReconciliationRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) watchForUpdates(gvk schema.GroupVersionKind) bool {
|
||||
if gvk.Group == "" && gvk.Version == "v1" && gvk.Kind == "Secret" {
|
||||
return false
|
||||
}
|
||||
func (a *ApplyResourcesAction) apply(ctx context.Context, rc *ReconciliationRequest, in *unstructured.Unstructured, force bool) error {
|
||||
obj := in.DeepCopy()
|
||||
obj.SetNamespace(rc.Resource.Spec.Deployment.Namespace)
|
||||
obj.SetOwnerReferences(resources.OwnerReferences(rc.Resource))
|
||||
|
||||
if gvk.Group == "admissionregistration.k8s.io" && gvk.Version == "v1" && gvk.Kind == "MutatingWebhookConfiguration" {
|
||||
return false
|
||||
}
|
||||
|
||||
if gvk.Group == "apiextensions.k8s.io" && gvk.Version == "v1" && gvk.Kind == "CustomResourceDefinition" {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) watchStatus(gvk schema.GroupVersionKind) bool {
|
||||
if gvk.Group == "apps" && gvk.Version == "v1" && gvk.Kind == "Deployment" {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) installOnly(gvk schema.GroupVersionKind) bool {
|
||||
if gvk.Group == "" && gvk.Version == "v1" && gvk.Kind == "Secret" {
|
||||
return true
|
||||
}
|
||||
|
||||
if gvk.Group == "admissionregistration.k8s.io" && gvk.Version == "v1" && gvk.Kind == "MutatingWebhookConfiguration" {
|
||||
return true
|
||||
}
|
||||
|
||||
if gvk.Group == "apiextensions.k8s.io" && gvk.Version == "v1" && gvk.Kind == "CustomResourceDefinition" {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
//nolint:cyclop
|
||||
func (a *ApplyResourcesAction) apply(ctx context.Context, rc *ReconciliationRequest, obj *unstructured.Unstructured, force bool) error {
|
||||
dc, err := rc.Client.Dynamic(rc.Resource.Namespace, obj)
|
||||
dc, err := rc.Client.Dynamic(obj)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot create dynamic client: %w", err)
|
||||
}
|
||||
|
||||
switch dc.(type) {
|
||||
//
|
||||
// NamespacedResource: in this case, filtering with ownership can be implemented
|
||||
// as all the namespaced resources created by this controller have the Dapr CR as
|
||||
// an owner
|
||||
//
|
||||
case *client.NamespacedResource:
|
||||
if err := a.watchNamespaceScopeResource(rc, obj); err != nil {
|
||||
return err
|
||||
}
|
||||
if dc.Scope() == client.ResourceScopeCluster {
|
||||
obj.SetNamespace("")
|
||||
}
|
||||
|
||||
//
|
||||
// ClusteredResource: in this case, ownership based filtering is not supported
|
||||
// as you cannot have a non namespaced owner. For such reason, the resource for
|
||||
// which a reconcile should be triggered can be identified by using the labels
|
||||
// added by the controller to all the generated resources
|
||||
//
|
||||
// helm.operator.dapr.io/resource.namespace = ${namespace}
|
||||
// helm.operator.dapr.io/resource.name = ${name}
|
||||
//
|
||||
case *client.ClusteredResource:
|
||||
if err := a.watchClusterScopeResource(rc, obj); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := a.watchResource(rc, obj); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !force {
|
||||
old, err := dc.Get(ctx, obj.GetName(), metav1.GetOptions{})
|
||||
if err != nil && !k8serrors.IsNotFound(err) {
|
||||
return fmt.Errorf("cannot get object %s: %w", resources.Ref(obj), err)
|
||||
}
|
||||
exists, err := a.exists(ctx, rc, in)
|
||||
|
||||
if old != nil {
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case !exists:
|
||||
break
|
||||
default:
|
||||
//
|
||||
// Every time the template is rendered, the helm function genSignedCert kicks in and
|
||||
// re-generated certs which causes a number os side effects and makes the set-up quite
|
||||
|
@ -234,8 +146,10 @@ func (a *ApplyResourcesAction) apply(ctx context.Context, rc *ReconciliationRequ
|
|||
//
|
||||
a.l.Info("run",
|
||||
"apply", "false",
|
||||
"gen", rc.Resource.Generation,
|
||||
"ref", resources.Ref(obj),
|
||||
"gen", in.GetLabels()[helm.ReleaseGeneration],
|
||||
"version", in.GetLabels()[helm.ReleaseVersion],
|
||||
"scope", dc.Scope(),
|
||||
"reason", "resource marked as install-only")
|
||||
|
||||
return nil
|
||||
|
@ -253,36 +167,51 @@ func (a *ApplyResourcesAction) apply(ctx context.Context, rc *ReconciliationRequ
|
|||
|
||||
a.l.Info("run",
|
||||
"apply", "true",
|
||||
"gen", rc.Resource.Generation,
|
||||
"ref", resources.Ref(obj))
|
||||
"ref", resources.Ref(obj),
|
||||
"gen", in.GetLabels()[helm.ReleaseGeneration],
|
||||
"version", in.GetLabels()[helm.ReleaseVersion],
|
||||
"scope", dc.Scope())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) watchNamespaceScopeResource(rc *ReconciliationRequest, obj *unstructured.Unstructured) error {
|
||||
gvk := obj.GroupVersionKind()
|
||||
|
||||
obj.SetOwnerReferences(resources.OwnerReferences(rc.Resource))
|
||||
obj.SetNamespace(rc.Resource.Namespace)
|
||||
|
||||
r := gvk.GroupVersion().String() + ":" + gvk.Kind
|
||||
func (a *ApplyResourcesAction) watchResource(rc *ReconciliationRequest, obj *unstructured.Unstructured) error {
|
||||
r := resources.GvkRef(obj)
|
||||
|
||||
if _, ok := a.subscriptions[r]; ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
if _, ok := a.subscriptions[r]; !ok {
|
||||
a.l.Info("watch", "scope", "namespace", "ref", r)
|
||||
var err error
|
||||
|
||||
err := rc.Reconciler.Watch(
|
||||
obj,
|
||||
rc.Reconciler.EnqueueRequestForOwner(&daprApi.DaprInstance{}, handler.OnlyControllerOwner()),
|
||||
dependantWithLabels(
|
||||
predicates.WithWatchUpdate(a.watchForUpdates(gvk)),
|
||||
predicates.WithWatchDeleted(true),
|
||||
predicates.WithWatchStatus(a.watchStatus(gvk)),
|
||||
),
|
||||
)
|
||||
if a.watchStatus(obj) {
|
||||
a.l.Info("watch", "ref", r, "meta-only", false)
|
||||
|
||||
err = rc.Reconciler.Watch(
|
||||
obj,
|
||||
rc.Reconciler.EnqueueRequestForOwner(&daprApi.DaprInstance{}, handler.OnlyControllerOwner()),
|
||||
dependantWithLabels(
|
||||
predicates.WithWatchUpdate(!a.installOnly(obj)),
|
||||
predicates.WithWatchDeleted(true),
|
||||
predicates.WithWatchStatus(true),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
a.l.Info("watch", "ref", r, "meta-only", true)
|
||||
|
||||
po := metav1.PartialObjectMetadata{}
|
||||
po.SetGroupVersionKind(obj.GroupVersionKind())
|
||||
|
||||
err = rc.Reconciler.Watch(
|
||||
&po,
|
||||
rc.Reconciler.EnqueueRequestForOwner(&daprApi.DaprInstance{}, handler.OnlyControllerOwner()),
|
||||
partialDependantWithLabels(
|
||||
predicates.PartialWatchUpdate(!a.installOnly(obj)),
|
||||
predicates.PartialWatchDeleted(true),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -294,34 +223,57 @@ func (a *ApplyResourcesAction) watchNamespaceScopeResource(rc *ReconciliationReq
|
|||
return nil
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) watchClusterScopeResource(rc *ReconciliationRequest, obj *unstructured.Unstructured) error {
|
||||
gvk := obj.GroupVersionKind()
|
||||
func (a *ApplyResourcesAction) watchStatus(obj ctrlCli.Object) bool {
|
||||
in := obj.GetObjectKind().GroupVersionKind()
|
||||
|
||||
r := gvk.GroupVersion().String() + ":" + gvk.Kind
|
||||
|
||||
if _, ok := a.subscriptions[r]; ok {
|
||||
return nil
|
||||
switch {
|
||||
case in == gvks.Deployment:
|
||||
return true
|
||||
case in == gvks.StatefulSet:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
if _, ok := a.subscriptions[r]; !ok {
|
||||
a.l.Info("watch", "scope", "cluster", "ref", r)
|
||||
|
||||
err := rc.Reconciler.Watch(
|
||||
obj,
|
||||
rc.Reconciler.EnqueueRequestsFromMapFunc(labelsToRequest),
|
||||
dependantWithLabels(
|
||||
predicates.WithWatchUpdate(a.watchForUpdates(gvk)),
|
||||
predicates.WithWatchDeleted(true),
|
||||
predicates.WithWatchStatus(a.watchStatus(gvk)),
|
||||
),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
a.subscriptions[r] = struct{}{}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) installOnly(obj ctrlCli.Object) bool {
|
||||
in := obj.GetObjectKind().GroupVersionKind()
|
||||
|
||||
switch {
|
||||
case in == gvks.Secret:
|
||||
return true
|
||||
case in == gvks.MutatingWebhookConfiguration:
|
||||
return true
|
||||
case in == gvks.CustomResourceDefinition:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (a *ApplyResourcesAction) exists(ctx context.Context, rc *ReconciliationRequest, in ctrlCli.Object) (bool, error) {
|
||||
var obj ctrlCli.Object
|
||||
|
||||
if !a.watchStatus(in) {
|
||||
p := metav1.PartialObjectMetadata{}
|
||||
p.SetGroupVersionKind(in.GetObjectKind().GroupVersionKind())
|
||||
|
||||
obj = &p
|
||||
} else {
|
||||
p := unstructured.Unstructured{}
|
||||
p.SetGroupVersionKind(in.GetObjectKind().GroupVersionKind())
|
||||
|
||||
obj = &p
|
||||
}
|
||||
|
||||
err := rc.Client.Get(ctx, ctrlCli.ObjectKeyFromObject(in), obj)
|
||||
if k8serrors.IsNotFound(err) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("cannot get object %s: %w", resources.Ref(in), err)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/client"
|
||||
"github.com/go-logr/logr"
|
||||
helme "github.com/lburgazzoli/k8s-manifests-renderer-helm/engine"
|
||||
|
@ -40,7 +40,7 @@ func (a *ChartAction) Run(ctx context.Context, rc *ReconciliationRequest) error
|
|||
}
|
||||
|
||||
if rc.Resource.Status.Chart == nil {
|
||||
rc.Resource.Status.Chart = &v1alpha1.ChartMeta{}
|
||||
rc.Resource.Status.Chart = &v1beta1.ChartMeta{}
|
||||
}
|
||||
|
||||
rc.Resource.Status.Chart.Repo = ChartRepoEmbedded
|
||||
|
|
|
@ -50,11 +50,11 @@ func (a *ConditionsAction) Run(ctx context.Context, rc *ReconciliationRequest) e
|
|||
var readyCondition metav1.Condition
|
||||
|
||||
if deployments+statefulSets > 0 {
|
||||
reason := "Ready"
|
||||
reason := conditions.ReasonReady
|
||||
status := metav1.ConditionTrue
|
||||
|
||||
if readyDeployments+readyReplicaSets != deployments+statefulSets {
|
||||
reason = "InProgress"
|
||||
reason = conditions.ReasonInProgress
|
||||
status = metav1.ConditionFalse
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ func (a *ConditionsAction) Run(ctx context.Context, rc *ReconciliationRequest) e
|
|||
readyCondition = metav1.Condition{
|
||||
Type: conditions.TypeReady,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: "InProgress",
|
||||
Reason: conditions.ReasonInProgress,
|
||||
Message: "no deployments/replicasets",
|
||||
ObservedGeneration: rc.Resource.Generation,
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ func (a *ConditionsAction) Cleanup(_ context.Context, _ *ReconciliationRequest)
|
|||
}
|
||||
|
||||
func (a *ConditionsAction) deployments(ctx context.Context, rc *ReconciliationRequest, selector labels.Selector) (int, int, error) {
|
||||
objects, err := rc.Client.AppsV1().Deployments(rc.Resource.Namespace).List(ctx, metav1.ListOptions{
|
||||
objects, err := rc.Client.AppsV1().Deployments(rc.Resource.Spec.Deployment.Namespace).List(ctx, metav1.ListOptions{
|
||||
LabelSelector: selector.String(),
|
||||
})
|
||||
|
||||
|
@ -107,7 +107,7 @@ func (a *ConditionsAction) deployments(ctx context.Context, rc *ReconciliationRe
|
|||
}
|
||||
|
||||
func (a *ConditionsAction) statefulSets(ctx context.Context, rc *ReconciliationRequest, selector labels.Selector) (int, int, error) {
|
||||
objects, err := rc.Client.AppsV1().StatefulSets(rc.Resource.Namespace).List(ctx, metav1.ListOptions{
|
||||
objects, err := rc.Client.AppsV1().StatefulSets(rc.Resource.Spec.Deployment.Namespace).List(ctx, metav1.ListOptions{
|
||||
LabelSelector: selector.String(),
|
||||
})
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/gc"
|
||||
"github.com/dapr/kubernetes-operator/pkg/helm"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
@ -56,7 +58,7 @@ func (a *GCAction) Run(ctx context.Context, rc *ReconciliationRequest) error {
|
|||
return fmt.Errorf("cannot compute gc selector: %w", err)
|
||||
}
|
||||
|
||||
deleted, err := a.gc.Run(ctx, rc.Client, rc.Resource.Namespace, s, func(ctx context.Context, obj unstructured.Unstructured) (bool, error) {
|
||||
deleted, err := a.gc.Run(ctx, rc.Client, controller.OperatorNamespace(), s, func(ctx context.Context, obj unstructured.Unstructured) (bool, error) {
|
||||
if obj.GetLabels() == nil {
|
||||
return false, nil
|
||||
}
|
||||
|
|
|
@ -30,23 +30,17 @@ import (
|
|||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
)
|
||||
|
||||
func (r *Reconciler) reconciliationRequest(res *daprApi.DaprInstance) (ReconciliationRequest, error) {
|
||||
rr := ReconciliationRequest{
|
||||
Client: r.Client(),
|
||||
NamespacedName: types.NamespacedName{
|
||||
Name: res.Name,
|
||||
Namespace: res.Namespace,
|
||||
},
|
||||
ClusterType: r.ClusterType,
|
||||
Reconciler: r,
|
||||
Resource: res,
|
||||
Client: r.Client(),
|
||||
Reconciler: r,
|
||||
Resource: res,
|
||||
Helm: Helm{
|
||||
engine: r.helmEngine,
|
||||
chartDir: r.helmOptions.ChartsDir,
|
||||
|
@ -82,7 +76,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, res *daprApi.DaprInstance) (
|
|||
}
|
||||
|
||||
l := log.FromContext(ctx)
|
||||
l.Info("Reconciling", "resource", rr.NamespacedName.String())
|
||||
l.Info("Reconciling", "resource", rr.Resource.Name)
|
||||
|
||||
//
|
||||
// Reconcile
|
||||
|
@ -147,7 +141,7 @@ func (r *Reconciler) Cleanup(ctx context.Context, res *daprApi.DaprInstance) err
|
|||
}
|
||||
|
||||
l := log.FromContext(ctx)
|
||||
l.Info("Cleanup", "resource", rr.NamespacedName.String())
|
||||
l.Info("Cleanup", "resource", rr.Resource.Name)
|
||||
|
||||
// Cleanup leftovers if needed
|
||||
for i := len(r.actions) - 1; i >= 0; i-- {
|
||||
|
|
|
@ -7,14 +7,10 @@ import (
|
|||
|
||||
"github.com/dapr/kubernetes-operator/pkg/helm"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/predicates"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/selection"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
ctrlCli "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/predicates"
|
||||
)
|
||||
|
||||
func gcSelector(ctx context.Context, rc *ReconciliationRequest) (labels.Selector, error) {
|
||||
|
@ -23,15 +19,6 @@ func gcSelector(ctx context.Context, rc *ReconciliationRequest) (labels.Selector
|
|||
return nil, fmt.Errorf("cannot load chart: %w", err)
|
||||
}
|
||||
|
||||
namespace, err := labels.NewRequirement(
|
||||
helm.ReleaseNamespace,
|
||||
selection.Equals,
|
||||
[]string{rc.Resource.Namespace})
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot determine release namespace requirement: %w", err)
|
||||
}
|
||||
|
||||
name, err := labels.NewRequirement(
|
||||
helm.ReleaseName,
|
||||
selection.Equals,
|
||||
|
@ -60,7 +47,6 @@ func gcSelector(ctx context.Context, rc *ReconciliationRequest) (labels.Selector
|
|||
}
|
||||
|
||||
selector := labels.NewSelector().
|
||||
Add(*namespace).
|
||||
Add(*name).
|
||||
Add(*generation).
|
||||
Add(*version)
|
||||
|
@ -68,30 +54,6 @@ func gcSelector(ctx context.Context, rc *ReconciliationRequest) (labels.Selector
|
|||
return selector, nil
|
||||
}
|
||||
|
||||
func labelsToRequest(_ context.Context, object ctrlCli.Object) []reconcile.Request {
|
||||
allLabels := object.GetLabels()
|
||||
if allLabels == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
name := allLabels[helm.ReleaseName]
|
||||
if name == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
namespace := allLabels[helm.ReleaseNamespace]
|
||||
if namespace == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
return []reconcile.Request{{
|
||||
NamespacedName: types.NamespacedName{
|
||||
Name: name,
|
||||
Namespace: namespace,
|
||||
},
|
||||
}}
|
||||
}
|
||||
|
||||
func dependantWithLabels(opts ...predicates.DependentPredicateOption) predicate.Predicate {
|
||||
dp := &predicates.DependentPredicate{}
|
||||
|
||||
|
@ -103,8 +65,19 @@ func dependantWithLabels(opts ...predicates.DependentPredicateOption) predicate.
|
|||
&predicates.HasLabel{
|
||||
Name: helm.ReleaseName,
|
||||
},
|
||||
dp,
|
||||
)
|
||||
}
|
||||
func partialDependantWithLabels(opts ...predicates.PartialDependentPredicateOption) predicate.Predicate {
|
||||
dp := &predicates.PartialDependentPredicate{}
|
||||
|
||||
for i := range opts {
|
||||
dp = opts[i](dp)
|
||||
}
|
||||
|
||||
return predicate.And(
|
||||
&predicates.HasLabel{
|
||||
Name: helm.ReleaseNamespace,
|
||||
Name: helm.ReleaseName,
|
||||
},
|
||||
dp,
|
||||
)
|
||||
|
@ -116,15 +89,6 @@ func currentReleaseSelector(ctx context.Context, rc *ReconciliationRequest) (lab
|
|||
return nil, fmt.Errorf("cannot load chart: %w", err)
|
||||
}
|
||||
|
||||
namespace, err := labels.NewRequirement(
|
||||
helm.ReleaseNamespace,
|
||||
selection.Equals,
|
||||
[]string{rc.Resource.Namespace})
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot determine release namespace requirement: %w", err)
|
||||
}
|
||||
|
||||
name, err := labels.NewRequirement(
|
||||
helm.ReleaseName,
|
||||
selection.Equals,
|
||||
|
@ -153,7 +117,6 @@ func currentReleaseSelector(ctx context.Context, rc *ReconciliationRequest) (lab
|
|||
}
|
||||
|
||||
selector := labels.NewSelector().
|
||||
Add(*namespace).
|
||||
Add(*name).
|
||||
Add(*generation).
|
||||
Add(*version)
|
||||
|
|
|
@ -10,10 +10,8 @@ import (
|
|||
|
||||
helme "github.com/lburgazzoli/k8s-manifests-renderer-helm/engine"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller/client"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||
)
|
||||
|
||||
|
@ -24,12 +22,10 @@ const (
|
|||
|
||||
type ReconciliationRequest struct {
|
||||
*client.Client
|
||||
types.NamespacedName
|
||||
|
||||
Reconciler *Reconciler
|
||||
ClusterType controller.ClusterType
|
||||
Resource *daprApi.DaprInstance
|
||||
Helm Helm
|
||||
Reconciler *Reconciler
|
||||
Resource *daprApi.DaprInstance
|
||||
Helm Helm
|
||||
}
|
||||
|
||||
type Helm struct {
|
||||
|
@ -81,7 +77,7 @@ func (rr *ReconciliationRequest) computeChartOptions(ctx context.Context) ([]hel
|
|||
chartOpts = append(chartOpts, helme.WithValuesCustomizers(values.JQ(autoPullPolicySidecarInjector)))
|
||||
|
||||
if rr.Resource.Spec.Chart != nil && rr.Resource.Spec.Chart.Secret != "" {
|
||||
s, err := rr.Client.CoreV1().Secrets(rr.Resource.Namespace).Get(
|
||||
s, err := rr.Client.CoreV1().Secrets(rr.Resource.Spec.Deployment.Namespace).Get(
|
||||
ctx,
|
||||
rr.Resource.Spec.Chart.Secret,
|
||||
metav1.GetOptions{},
|
||||
|
|
|
@ -38,7 +38,7 @@ func Parser() *typed.Parser {
|
|||
var parserOnce sync.Once
|
||||
var parser *typed.Parser
|
||||
var schemaYAML = typed.YAMLObject(`types:
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.ChartMeta
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.ChartMeta
|
||||
map:
|
||||
fields:
|
||||
- name: name
|
||||
|
@ -50,7 +50,7 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||
- name: version
|
||||
type:
|
||||
scalar: string
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.ChartSpec
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.ChartSpec
|
||||
map:
|
||||
fields:
|
||||
- name: name
|
||||
|
@ -65,7 +65,7 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||
- name: version
|
||||
type:
|
||||
scalar: string
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprControlPlane
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprCruiseControl
|
||||
map:
|
||||
fields:
|
||||
- name: apiVersion
|
||||
|
@ -80,59 +80,13 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||
default: {}
|
||||
- name: spec
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprControlPlaneSpec
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprCruiseControlSpec
|
||||
default: {}
|
||||
- name: status
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprControlPlaneStatus
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprCruiseControlStatus
|
||||
default: {}
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprControlPlaneSpec
|
||||
map:
|
||||
fields:
|
||||
- name: values
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.JSON
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprControlPlaneStatus
|
||||
map:
|
||||
fields:
|
||||
- name: chart
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.ChartMeta
|
||||
- name: conditions
|
||||
type:
|
||||
list:
|
||||
elementType:
|
||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition
|
||||
elementRelationship: atomic
|
||||
- name: observedGeneration
|
||||
type:
|
||||
scalar: numeric
|
||||
- name: phase
|
||||
type:
|
||||
scalar: string
|
||||
default: ""
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprCruiseControl
|
||||
map:
|
||||
fields:
|
||||
- name: apiVersion
|
||||
type:
|
||||
scalar: string
|
||||
- name: kind
|
||||
type:
|
||||
scalar: string
|
||||
- name: metadata
|
||||
type:
|
||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
|
||||
default: {}
|
||||
- name: spec
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprCruiseControlSpec
|
||||
default: {}
|
||||
- name: status
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprCruiseControlStatus
|
||||
default: {}
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprCruiseControlSpec
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprCruiseControlSpec
|
||||
map:
|
||||
elementType:
|
||||
scalar: untyped
|
||||
|
@ -144,12 +98,12 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||
elementType:
|
||||
namedType: __untyped_deduced_
|
||||
elementRelationship: separable
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprCruiseControlStatus
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprCruiseControlStatus
|
||||
map:
|
||||
fields:
|
||||
- name: chart
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.ChartMeta
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.ChartMeta
|
||||
- name: conditions
|
||||
type:
|
||||
list:
|
||||
|
@ -163,7 +117,7 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||
type:
|
||||
scalar: string
|
||||
default: ""
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprInstance
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprInstance
|
||||
map:
|
||||
fields:
|
||||
- name: apiVersion
|
||||
|
@ -178,27 +132,31 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||
default: {}
|
||||
- name: spec
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprInstanceSpec
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprInstanceSpec
|
||||
default: {}
|
||||
- name: status
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprInstanceStatus
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprInstanceStatus
|
||||
default: {}
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprInstanceSpec
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprInstanceSpec
|
||||
map:
|
||||
fields:
|
||||
- name: chart
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.ChartSpec
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.ChartSpec
|
||||
- name: deployment
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DeploymentSpec
|
||||
default: {}
|
||||
- name: values
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.JSON
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprInstanceStatus
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.JSON
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprInstanceStatus
|
||||
map:
|
||||
fields:
|
||||
- name: chart
|
||||
type:
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.ChartMeta
|
||||
namedType: com.github.dapr.kubernetes-operator.api.operator.v1beta1.ChartMeta
|
||||
- name: conditions
|
||||
type:
|
||||
list:
|
||||
|
@ -212,7 +170,13 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||
type:
|
||||
scalar: string
|
||||
default: ""
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1alpha1.JSON
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.DeploymentSpec
|
||||
map:
|
||||
fields:
|
||||
- name: namespace
|
||||
type:
|
||||
scalar: string
|
||||
- name: com.github.dapr.kubernetes-operator.api.operator.v1beta1.JSON
|
||||
map:
|
||||
elementType:
|
||||
scalar: untyped
|
||||
|
|
|
@ -1,263 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
internal "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/internal"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// DaprControlPlaneApplyConfiguration represents a declarative configuration of the DaprControlPlane type for use
|
||||
// with apply.
|
||||
type DaprControlPlaneApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *DaprControlPlaneSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
Status *DaprControlPlaneStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// DaprControlPlane constructs a declarative configuration of the DaprControlPlane type for use with
|
||||
// apply.
|
||||
func DaprControlPlane(name, namespace string) *DaprControlPlaneApplyConfiguration {
|
||||
b := &DaprControlPlaneApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithNamespace(namespace)
|
||||
b.WithKind("DaprControlPlane")
|
||||
b.WithAPIVersion("operator.dapr.io/v1alpha1")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractDaprControlPlane extracts the applied configuration owned by fieldManager from
|
||||
// daprControlPlane. If no managedFields are found in daprControlPlane for fieldManager, a
|
||||
// DaprControlPlaneApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// daprControlPlane must be a unmodified DaprControlPlane API object that was retrieved from the Kubernetes API.
|
||||
// ExtractDaprControlPlane provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
// Experimental!
|
||||
func ExtractDaprControlPlane(daprControlPlane *operatorv1alpha1.DaprControlPlane, fieldManager string) (*DaprControlPlaneApplyConfiguration, error) {
|
||||
return extractDaprControlPlane(daprControlPlane, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractDaprControlPlaneStatus is the same as ExtractDaprControlPlane except
|
||||
// that it extracts the status subresource applied configuration.
|
||||
// Experimental!
|
||||
func ExtractDaprControlPlaneStatus(daprControlPlane *operatorv1alpha1.DaprControlPlane, fieldManager string) (*DaprControlPlaneApplyConfiguration, error) {
|
||||
return extractDaprControlPlane(daprControlPlane, fieldManager, "status")
|
||||
}
|
||||
|
||||
func extractDaprControlPlane(daprControlPlane *operatorv1alpha1.DaprControlPlane, fieldManager string, subresource string) (*DaprControlPlaneApplyConfiguration, error) {
|
||||
b := &DaprControlPlaneApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(daprControlPlane, internal.Parser().Type("com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprControlPlane"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(daprControlPlane.Name)
|
||||
b.WithNamespace(daprControlPlane.Namespace)
|
||||
|
||||
b.WithKind("DaprControlPlane")
|
||||
b.WithAPIVersion("operator.dapr.io/v1alpha1")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithKind(value string) *DaprControlPlaneApplyConfiguration {
|
||||
b.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithAPIVersion(value string) *DaprControlPlaneApplyConfiguration {
|
||||
b.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithName(value string) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithGenerateName(value string) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithNamespace(value string) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithUID(value types.UID) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithResourceVersion(value string) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithGeneration(value int64) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithCreationTimestamp(value metav1.Time) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithLabels(entries map[string]string) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.Labels == nil && len(entries) > 0 {
|
||||
b.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithAnnotations(entries map[string]string) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.Annotations == nil && len(entries) > 0 {
|
||||
b.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.OwnerReferences = append(b.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithFinalizers(values ...string) *DaprControlPlaneApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.Finalizers = append(b.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *DaprControlPlaneApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithSpec(value *DaprControlPlaneSpecApplyConfiguration) *DaprControlPlaneApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneApplyConfiguration) WithStatus(value *DaprControlPlaneStatusApplyConfiguration) *DaprControlPlaneApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *DaprControlPlaneApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.Name
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// DaprControlPlaneSpecApplyConfiguration represents a declarative configuration of the DaprControlPlaneSpec type for use
|
||||
// with apply.
|
||||
type DaprControlPlaneSpecApplyConfiguration struct {
|
||||
Values *JSONApplyConfiguration `json:"values,omitempty"`
|
||||
}
|
||||
|
||||
// DaprControlPlaneSpecApplyConfiguration constructs a declarative configuration of the DaprControlPlaneSpec type for use with
|
||||
// apply.
|
||||
func DaprControlPlaneSpec() *DaprControlPlaneSpecApplyConfiguration {
|
||||
return &DaprControlPlaneSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithValues sets the Values field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Values field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneSpecApplyConfiguration) WithValues(value *JSONApplyConfiguration) *DaprControlPlaneSpecApplyConfiguration {
|
||||
b.Values = value
|
||||
return b
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// DaprControlPlaneStatusApplyConfiguration represents a declarative configuration of the DaprControlPlaneStatus type for use
|
||||
// with apply.
|
||||
type DaprControlPlaneStatusApplyConfiguration struct {
|
||||
StatusApplyConfiguration `json:",inline"`
|
||||
Chart *ChartMetaApplyConfiguration `json:"chart,omitempty"`
|
||||
}
|
||||
|
||||
// DaprControlPlaneStatusApplyConfiguration constructs a declarative configuration of the DaprControlPlaneStatus type for use with
|
||||
// apply.
|
||||
func DaprControlPlaneStatus() *DaprControlPlaneStatusApplyConfiguration {
|
||||
return &DaprControlPlaneStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithPhase sets the Phase field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Phase field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneStatusApplyConfiguration) WithPhase(value string) *DaprControlPlaneStatusApplyConfiguration {
|
||||
b.Phase = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithConditions adds the given value to the Conditions field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Conditions field.
|
||||
func (b *DaprControlPlaneStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *DaprControlPlaneStatusApplyConfiguration {
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithConditions")
|
||||
}
|
||||
b.Conditions = append(b.Conditions, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ObservedGeneration field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneStatusApplyConfiguration) WithObservedGeneration(value int64) *DaprControlPlaneStatusApplyConfiguration {
|
||||
b.ObservedGeneration = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithChart sets the Chart field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Chart field is set to the value of the last call.
|
||||
func (b *DaprControlPlaneStatusApplyConfiguration) WithChart(value *ChartMetaApplyConfiguration) *DaprControlPlaneStatusApplyConfiguration {
|
||||
b.Chart = value
|
||||
return b
|
||||
}
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
// ChartMetaApplyConfiguration represents a declarative configuration of the ChartMeta type for use
|
||||
// with apply.
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
// ChartSpecApplyConfiguration represents a declarative configuration of the ChartSpec type for use
|
||||
// with apply.
|
|
@ -15,10 +15,10 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
internal "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/internal"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
|
@ -31,18 +31,17 @@ import (
|
|||
type DaprCruiseControlApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
Spec *v1alpha1.DaprCruiseControlSpec `json:"spec,omitempty"`
|
||||
Spec *v1beta1.DaprCruiseControlSpec `json:"spec,omitempty"`
|
||||
Status *DaprCruiseControlStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// DaprCruiseControl constructs a declarative configuration of the DaprCruiseControl type for use with
|
||||
// apply.
|
||||
func DaprCruiseControl(name, namespace string) *DaprCruiseControlApplyConfiguration {
|
||||
func DaprCruiseControl(name string) *DaprCruiseControlApplyConfiguration {
|
||||
b := &DaprCruiseControlApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithNamespace(namespace)
|
||||
b.WithKind("DaprCruiseControl")
|
||||
b.WithAPIVersion("operator.dapr.io/v1alpha1")
|
||||
b.WithAPIVersion("operator.dapr.io/v1beta1")
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -57,28 +56,27 @@ func DaprCruiseControl(name, namespace string) *DaprCruiseControlApplyConfigurat
|
|||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
// Experimental!
|
||||
func ExtractDaprCruiseControl(daprCruiseControl *v1alpha1.DaprCruiseControl, fieldManager string) (*DaprCruiseControlApplyConfiguration, error) {
|
||||
func ExtractDaprCruiseControl(daprCruiseControl *v1beta1.DaprCruiseControl, fieldManager string) (*DaprCruiseControlApplyConfiguration, error) {
|
||||
return extractDaprCruiseControl(daprCruiseControl, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractDaprCruiseControlStatus is the same as ExtractDaprCruiseControl except
|
||||
// that it extracts the status subresource applied configuration.
|
||||
// Experimental!
|
||||
func ExtractDaprCruiseControlStatus(daprCruiseControl *v1alpha1.DaprCruiseControl, fieldManager string) (*DaprCruiseControlApplyConfiguration, error) {
|
||||
func ExtractDaprCruiseControlStatus(daprCruiseControl *v1beta1.DaprCruiseControl, fieldManager string) (*DaprCruiseControlApplyConfiguration, error) {
|
||||
return extractDaprCruiseControl(daprCruiseControl, fieldManager, "status")
|
||||
}
|
||||
|
||||
func extractDaprCruiseControl(daprCruiseControl *v1alpha1.DaprCruiseControl, fieldManager string, subresource string) (*DaprCruiseControlApplyConfiguration, error) {
|
||||
func extractDaprCruiseControl(daprCruiseControl *v1beta1.DaprCruiseControl, fieldManager string, subresource string) (*DaprCruiseControlApplyConfiguration, error) {
|
||||
b := &DaprCruiseControlApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(daprCruiseControl, internal.Parser().Type("com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprCruiseControl"), fieldManager, b, subresource)
|
||||
err := managedfields.ExtractInto(daprCruiseControl, internal.Parser().Type("com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprCruiseControl"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(daprCruiseControl.Name)
|
||||
b.WithNamespace(daprCruiseControl.Namespace)
|
||||
|
||||
b.WithKind("DaprCruiseControl")
|
||||
b.WithAPIVersion("operator.dapr.io/v1alpha1")
|
||||
b.WithAPIVersion("operator.dapr.io/v1beta1")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
|
@ -243,7 +241,7 @@ func (b *DaprCruiseControlApplyConfiguration) ensureObjectMetaApplyConfiguration
|
|||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *DaprCruiseControlApplyConfiguration) WithSpec(value v1alpha1.DaprCruiseControlSpec) *DaprCruiseControlApplyConfiguration {
|
||||
func (b *DaprCruiseControlApplyConfiguration) WithSpec(value v1beta1.DaprCruiseControlSpec) *DaprCruiseControlApplyConfiguration {
|
||||
b.Spec = &value
|
||||
return b
|
||||
}
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
|
@ -15,10 +15,10 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
operatorv1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
internal "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/internal"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
|
@ -37,12 +37,11 @@ type DaprInstanceApplyConfiguration struct {
|
|||
|
||||
// DaprInstance constructs a declarative configuration of the DaprInstance type for use with
|
||||
// apply.
|
||||
func DaprInstance(name, namespace string) *DaprInstanceApplyConfiguration {
|
||||
func DaprInstance(name string) *DaprInstanceApplyConfiguration {
|
||||
b := &DaprInstanceApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithNamespace(namespace)
|
||||
b.WithKind("DaprInstance")
|
||||
b.WithAPIVersion("operator.dapr.io/v1alpha1")
|
||||
b.WithAPIVersion("operator.dapr.io/v1beta1")
|
||||
return b
|
||||
}
|
||||
|
||||
|
@ -57,28 +56,27 @@ func DaprInstance(name, namespace string) *DaprInstanceApplyConfiguration {
|
|||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
// Experimental!
|
||||
func ExtractDaprInstance(daprInstance *operatorv1alpha1.DaprInstance, fieldManager string) (*DaprInstanceApplyConfiguration, error) {
|
||||
func ExtractDaprInstance(daprInstance *operatorv1beta1.DaprInstance, fieldManager string) (*DaprInstanceApplyConfiguration, error) {
|
||||
return extractDaprInstance(daprInstance, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractDaprInstanceStatus is the same as ExtractDaprInstance except
|
||||
// that it extracts the status subresource applied configuration.
|
||||
// Experimental!
|
||||
func ExtractDaprInstanceStatus(daprInstance *operatorv1alpha1.DaprInstance, fieldManager string) (*DaprInstanceApplyConfiguration, error) {
|
||||
func ExtractDaprInstanceStatus(daprInstance *operatorv1beta1.DaprInstance, fieldManager string) (*DaprInstanceApplyConfiguration, error) {
|
||||
return extractDaprInstance(daprInstance, fieldManager, "status")
|
||||
}
|
||||
|
||||
func extractDaprInstance(daprInstance *operatorv1alpha1.DaprInstance, fieldManager string, subresource string) (*DaprInstanceApplyConfiguration, error) {
|
||||
func extractDaprInstance(daprInstance *operatorv1beta1.DaprInstance, fieldManager string, subresource string) (*DaprInstanceApplyConfiguration, error) {
|
||||
b := &DaprInstanceApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(daprInstance, internal.Parser().Type("com.github.dapr.kubernetes-operator.api.operator.v1alpha1.DaprInstance"), fieldManager, b, subresource)
|
||||
err := managedfields.ExtractInto(daprInstance, internal.Parser().Type("com.github.dapr.kubernetes-operator.api.operator.v1beta1.DaprInstance"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(daprInstance.Name)
|
||||
b.WithNamespace(daprInstance.Namespace)
|
||||
|
||||
b.WithKind("DaprInstance")
|
||||
b.WithAPIVersion("operator.dapr.io/v1alpha1")
|
||||
b.WithAPIVersion("operator.dapr.io/v1beta1")
|
||||
return b, nil
|
||||
}
|
||||
|
|
@ -15,13 +15,14 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
// DaprInstanceSpecApplyConfiguration represents a declarative configuration of the DaprInstanceSpec type for use
|
||||
// with apply.
|
||||
type DaprInstanceSpecApplyConfiguration struct {
|
||||
Chart *ChartSpecApplyConfiguration `json:"chart,omitempty"`
|
||||
Values *JSONApplyConfiguration `json:"values,omitempty"`
|
||||
Deployment *DeploymentSpecApplyConfiguration `json:"deployment,omitempty"`
|
||||
Chart *ChartSpecApplyConfiguration `json:"chart,omitempty"`
|
||||
Values *JSONApplyConfiguration `json:"values,omitempty"`
|
||||
}
|
||||
|
||||
// DaprInstanceSpecApplyConfiguration constructs a declarative configuration of the DaprInstanceSpec type for use with
|
||||
|
@ -30,6 +31,14 @@ func DaprInstanceSpec() *DaprInstanceSpecApplyConfiguration {
|
|||
return &DaprInstanceSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithDeployment sets the Deployment field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Deployment field is set to the value of the last call.
|
||||
func (b *DaprInstanceSpecApplyConfiguration) WithDeployment(value *DeploymentSpecApplyConfiguration) *DaprInstanceSpecApplyConfiguration {
|
||||
b.Deployment = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithChart sets the Chart field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Chart field is set to the value of the last call.
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
// DeploymentSpecApplyConfiguration represents a declarative configuration of the DeploymentSpec type for use
|
||||
// with apply.
|
||||
type DeploymentSpecApplyConfiguration struct {
|
||||
Namespace *string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// DeploymentSpecApplyConfiguration constructs a declarative configuration of the DeploymentSpec type for use with
|
||||
// apply.
|
||||
func DeploymentSpec() *DeploymentSpecApplyConfiguration {
|
||||
return &DeploymentSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *DeploymentSpecApplyConfiguration) WithNamespace(value string) *DeploymentSpecApplyConfiguration {
|
||||
b.Namespace = &value
|
||||
return b
|
||||
}
|
|
@ -15,16 +15,16 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
)
|
||||
|
||||
// JSONApplyConfiguration represents a declarative configuration of the JSON type for use
|
||||
// with apply.
|
||||
type JSONApplyConfiguration struct {
|
||||
v1alpha1.RawMessage `json:",inline"`
|
||||
v1beta1.RawMessage `json:",inline"`
|
||||
}
|
||||
|
||||
// JSONApplyConfiguration constructs a declarative configuration of the JSON type for use with
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
|
@ -18,9 +18,9 @@ limitations under the License.
|
|||
package applyconfiguration
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
internal "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/internal"
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
operatorv1beta1 "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1beta1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
testing "k8s.io/client-go/testing"
|
||||
|
@ -30,31 +30,27 @@ import (
|
|||
// apply configuration type exists for the given GroupVersionKind.
|
||||
func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
switch kind {
|
||||
// Group=operator.dapr.io, Version=v1alpha1
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("ChartMeta"):
|
||||
return &operatorv1alpha1.ChartMetaApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("ChartSpec"):
|
||||
return &operatorv1alpha1.ChartSpecApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("DaprControlPlane"):
|
||||
return &operatorv1alpha1.DaprControlPlaneApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("DaprControlPlaneSpec"):
|
||||
return &operatorv1alpha1.DaprControlPlaneSpecApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("DaprControlPlaneStatus"):
|
||||
return &operatorv1alpha1.DaprControlPlaneStatusApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("DaprCruiseControl"):
|
||||
return &operatorv1alpha1.DaprCruiseControlApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("DaprCruiseControlStatus"):
|
||||
return &operatorv1alpha1.DaprCruiseControlStatusApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("DaprInstance"):
|
||||
return &operatorv1alpha1.DaprInstanceApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("DaprInstanceSpec"):
|
||||
return &operatorv1alpha1.DaprInstanceSpecApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("DaprInstanceStatus"):
|
||||
return &operatorv1alpha1.DaprInstanceStatusApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("JSON"):
|
||||
return &operatorv1alpha1.JSONApplyConfiguration{}
|
||||
case v1alpha1.SchemeGroupVersion.WithKind("Status"):
|
||||
return &operatorv1alpha1.StatusApplyConfiguration{}
|
||||
// Group=operator.dapr.io, Version=v1beta1
|
||||
case v1beta1.SchemeGroupVersion.WithKind("ChartMeta"):
|
||||
return &operatorv1beta1.ChartMetaApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("ChartSpec"):
|
||||
return &operatorv1beta1.ChartSpecApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("DaprCruiseControl"):
|
||||
return &operatorv1beta1.DaprCruiseControlApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("DaprCruiseControlStatus"):
|
||||
return &operatorv1beta1.DaprCruiseControlStatusApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("DaprInstance"):
|
||||
return &operatorv1beta1.DaprInstanceApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("DaprInstanceSpec"):
|
||||
return &operatorv1beta1.DaprInstanceSpecApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("DaprInstanceStatus"):
|
||||
return &operatorv1beta1.DaprInstanceStatusApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("DeploymentSpec"):
|
||||
return &operatorv1beta1.DeploymentSpecApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("JSON"):
|
||||
return &operatorv1beta1.JSONApplyConfiguration{}
|
||||
case v1beta1.SchemeGroupVersion.WithKind("Status"):
|
||||
return &operatorv1beta1.StatusApplyConfiguration{}
|
||||
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned/typed/operator/v1alpha1"
|
||||
operatorv1beta1 "github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned/typed/operator/v1beta1"
|
||||
discovery "k8s.io/client-go/discovery"
|
||||
rest "k8s.io/client-go/rest"
|
||||
flowcontrol "k8s.io/client-go/util/flowcontrol"
|
||||
|
@ -29,18 +29,18 @@ import (
|
|||
|
||||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
OperatorV1alpha1() operatorv1alpha1.OperatorV1alpha1Interface
|
||||
OperatorV1beta1() operatorv1beta1.OperatorV1beta1Interface
|
||||
}
|
||||
|
||||
// Clientset contains the clients for groups.
|
||||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
operatorV1alpha1 *operatorv1alpha1.OperatorV1alpha1Client
|
||||
operatorV1beta1 *operatorv1beta1.OperatorV1beta1Client
|
||||
}
|
||||
|
||||
// OperatorV1alpha1 retrieves the OperatorV1alpha1Client
|
||||
func (c *Clientset) OperatorV1alpha1() operatorv1alpha1.OperatorV1alpha1Interface {
|
||||
return c.operatorV1alpha1
|
||||
// OperatorV1beta1 retrieves the OperatorV1beta1Client
|
||||
func (c *Clientset) OperatorV1beta1() operatorv1beta1.OperatorV1beta1Interface {
|
||||
return c.operatorV1beta1
|
||||
}
|
||||
|
||||
// Discovery retrieves the DiscoveryClient
|
||||
|
@ -87,7 +87,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
|
|||
|
||||
var cs Clientset
|
||||
var err error
|
||||
cs.operatorV1alpha1, err = operatorv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||
cs.operatorV1beta1, err = operatorv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
|||
// New creates a new Clientset for the given RESTClient.
|
||||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.operatorV1alpha1 = operatorv1alpha1.New(c)
|
||||
cs.operatorV1beta1 = operatorv1beta1.New(c)
|
||||
|
||||
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
|
||||
return &cs
|
||||
|
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
|||
package scheme
|
||||
|
||||
import (
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
operatorv1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
@ -30,7 +30,7 @@ var Scheme = runtime.NewScheme()
|
|||
var Codecs = serializer.NewCodecFactory(Scheme)
|
||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
operatorv1alpha1.AddToScheme,
|
||||
operatorv1beta1.AddToScheme,
|
||||
}
|
||||
|
||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
scheme "github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
)
|
||||
|
||||
// DaprControlPlanesGetter has a method to return a DaprControlPlaneInterface.
|
||||
// A group's client should implement this interface.
|
||||
type DaprControlPlanesGetter interface {
|
||||
DaprControlPlanes(namespace string) DaprControlPlaneInterface
|
||||
}
|
||||
|
||||
// DaprControlPlaneInterface has methods to work with DaprControlPlane resources.
|
||||
type DaprControlPlaneInterface interface {
|
||||
Create(ctx context.Context, daprControlPlane *v1alpha1.DaprControlPlane, opts v1.CreateOptions) (*v1alpha1.DaprControlPlane, error)
|
||||
Update(ctx context.Context, daprControlPlane *v1alpha1.DaprControlPlane, opts v1.UpdateOptions) (*v1alpha1.DaprControlPlane, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, daprControlPlane *v1alpha1.DaprControlPlane, opts v1.UpdateOptions) (*v1alpha1.DaprControlPlane, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.DaprControlPlane, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.DaprControlPlaneList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DaprControlPlane, err error)
|
||||
Apply(ctx context.Context, daprControlPlane *operatorv1alpha1.DaprControlPlaneApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.DaprControlPlane, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, daprControlPlane *operatorv1alpha1.DaprControlPlaneApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.DaprControlPlane, err error)
|
||||
DaprControlPlaneExpansion
|
||||
}
|
||||
|
||||
// daprControlPlanes implements DaprControlPlaneInterface
|
||||
type daprControlPlanes struct {
|
||||
*gentype.ClientWithListAndApply[*v1alpha1.DaprControlPlane, *v1alpha1.DaprControlPlaneList, *operatorv1alpha1.DaprControlPlaneApplyConfiguration]
|
||||
}
|
||||
|
||||
// newDaprControlPlanes returns a DaprControlPlanes
|
||||
func newDaprControlPlanes(c *OperatorV1alpha1Client, namespace string) *daprControlPlanes {
|
||||
return &daprControlPlanes{
|
||||
gentype.NewClientWithListAndApply[*v1alpha1.DaprControlPlane, *v1alpha1.DaprControlPlaneList, *operatorv1alpha1.DaprControlPlaneApplyConfiguration](
|
||||
"daprcontrolplanes",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *v1alpha1.DaprControlPlane { return &v1alpha1.DaprControlPlane{} },
|
||||
func() *v1alpha1.DaprControlPlaneList { return &v1alpha1.DaprControlPlaneList{} }),
|
||||
}
|
||||
}
|
|
@ -15,13 +15,13 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
operatorv1beta1 "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1beta1"
|
||||
scheme "github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
|
@ -32,41 +32,41 @@ import (
|
|||
// DaprCruiseControlsGetter has a method to return a DaprCruiseControlInterface.
|
||||
// A group's client should implement this interface.
|
||||
type DaprCruiseControlsGetter interface {
|
||||
DaprCruiseControls(namespace string) DaprCruiseControlInterface
|
||||
DaprCruiseControls() DaprCruiseControlInterface
|
||||
}
|
||||
|
||||
// DaprCruiseControlInterface has methods to work with DaprCruiseControl resources.
|
||||
type DaprCruiseControlInterface interface {
|
||||
Create(ctx context.Context, daprCruiseControl *v1alpha1.DaprCruiseControl, opts v1.CreateOptions) (*v1alpha1.DaprCruiseControl, error)
|
||||
Update(ctx context.Context, daprCruiseControl *v1alpha1.DaprCruiseControl, opts v1.UpdateOptions) (*v1alpha1.DaprCruiseControl, error)
|
||||
Create(ctx context.Context, daprCruiseControl *v1beta1.DaprCruiseControl, opts v1.CreateOptions) (*v1beta1.DaprCruiseControl, error)
|
||||
Update(ctx context.Context, daprCruiseControl *v1beta1.DaprCruiseControl, opts v1.UpdateOptions) (*v1beta1.DaprCruiseControl, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, daprCruiseControl *v1alpha1.DaprCruiseControl, opts v1.UpdateOptions) (*v1alpha1.DaprCruiseControl, error)
|
||||
UpdateStatus(ctx context.Context, daprCruiseControl *v1beta1.DaprCruiseControl, opts v1.UpdateOptions) (*v1beta1.DaprCruiseControl, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.DaprCruiseControl, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.DaprCruiseControlList, error)
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DaprCruiseControl, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DaprCruiseControlList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DaprCruiseControl, err error)
|
||||
Apply(ctx context.Context, daprCruiseControl *operatorv1alpha1.DaprCruiseControlApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.DaprCruiseControl, err error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DaprCruiseControl, err error)
|
||||
Apply(ctx context.Context, daprCruiseControl *operatorv1beta1.DaprCruiseControlApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.DaprCruiseControl, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, daprCruiseControl *operatorv1alpha1.DaprCruiseControlApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.DaprCruiseControl, err error)
|
||||
ApplyStatus(ctx context.Context, daprCruiseControl *operatorv1beta1.DaprCruiseControlApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.DaprCruiseControl, err error)
|
||||
DaprCruiseControlExpansion
|
||||
}
|
||||
|
||||
// daprCruiseControls implements DaprCruiseControlInterface
|
||||
type daprCruiseControls struct {
|
||||
*gentype.ClientWithListAndApply[*v1alpha1.DaprCruiseControl, *v1alpha1.DaprCruiseControlList, *operatorv1alpha1.DaprCruiseControlApplyConfiguration]
|
||||
*gentype.ClientWithListAndApply[*v1beta1.DaprCruiseControl, *v1beta1.DaprCruiseControlList, *operatorv1beta1.DaprCruiseControlApplyConfiguration]
|
||||
}
|
||||
|
||||
// newDaprCruiseControls returns a DaprCruiseControls
|
||||
func newDaprCruiseControls(c *OperatorV1alpha1Client, namespace string) *daprCruiseControls {
|
||||
func newDaprCruiseControls(c *OperatorV1beta1Client) *daprCruiseControls {
|
||||
return &daprCruiseControls{
|
||||
gentype.NewClientWithListAndApply[*v1alpha1.DaprCruiseControl, *v1alpha1.DaprCruiseControlList, *operatorv1alpha1.DaprCruiseControlApplyConfiguration](
|
||||
gentype.NewClientWithListAndApply[*v1beta1.DaprCruiseControl, *v1beta1.DaprCruiseControlList, *operatorv1beta1.DaprCruiseControlApplyConfiguration](
|
||||
"daprcruisecontrols",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *v1alpha1.DaprCruiseControl { return &v1alpha1.DaprCruiseControl{} },
|
||||
func() *v1alpha1.DaprCruiseControlList { return &v1alpha1.DaprCruiseControlList{} }),
|
||||
"",
|
||||
func() *v1beta1.DaprCruiseControl { return &v1beta1.DaprCruiseControl{} },
|
||||
func() *v1beta1.DaprCruiseControlList { return &v1beta1.DaprCruiseControlList{} }),
|
||||
}
|
||||
}
|
|
@ -15,13 +15,13 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
operatorv1beta1 "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1beta1"
|
||||
scheme "github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
|
@ -32,41 +32,41 @@ import (
|
|||
// DaprInstancesGetter has a method to return a DaprInstanceInterface.
|
||||
// A group's client should implement this interface.
|
||||
type DaprInstancesGetter interface {
|
||||
DaprInstances(namespace string) DaprInstanceInterface
|
||||
DaprInstances() DaprInstanceInterface
|
||||
}
|
||||
|
||||
// DaprInstanceInterface has methods to work with DaprInstance resources.
|
||||
type DaprInstanceInterface interface {
|
||||
Create(ctx context.Context, daprInstance *v1alpha1.DaprInstance, opts v1.CreateOptions) (*v1alpha1.DaprInstance, error)
|
||||
Update(ctx context.Context, daprInstance *v1alpha1.DaprInstance, opts v1.UpdateOptions) (*v1alpha1.DaprInstance, error)
|
||||
Create(ctx context.Context, daprInstance *v1beta1.DaprInstance, opts v1.CreateOptions) (*v1beta1.DaprInstance, error)
|
||||
Update(ctx context.Context, daprInstance *v1beta1.DaprInstance, opts v1.UpdateOptions) (*v1beta1.DaprInstance, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, daprInstance *v1alpha1.DaprInstance, opts v1.UpdateOptions) (*v1alpha1.DaprInstance, error)
|
||||
UpdateStatus(ctx context.Context, daprInstance *v1beta1.DaprInstance, opts v1.UpdateOptions) (*v1beta1.DaprInstance, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.DaprInstance, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.DaprInstanceList, error)
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.DaprInstance, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.DaprInstanceList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DaprInstance, err error)
|
||||
Apply(ctx context.Context, daprInstance *operatorv1alpha1.DaprInstanceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.DaprInstance, err error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DaprInstance, err error)
|
||||
Apply(ctx context.Context, daprInstance *operatorv1beta1.DaprInstanceApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.DaprInstance, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, daprInstance *operatorv1alpha1.DaprInstanceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.DaprInstance, err error)
|
||||
ApplyStatus(ctx context.Context, daprInstance *operatorv1beta1.DaprInstanceApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.DaprInstance, err error)
|
||||
DaprInstanceExpansion
|
||||
}
|
||||
|
||||
// daprInstances implements DaprInstanceInterface
|
||||
type daprInstances struct {
|
||||
*gentype.ClientWithListAndApply[*v1alpha1.DaprInstance, *v1alpha1.DaprInstanceList, *operatorv1alpha1.DaprInstanceApplyConfiguration]
|
||||
*gentype.ClientWithListAndApply[*v1beta1.DaprInstance, *v1beta1.DaprInstanceList, *operatorv1beta1.DaprInstanceApplyConfiguration]
|
||||
}
|
||||
|
||||
// newDaprInstances returns a DaprInstances
|
||||
func newDaprInstances(c *OperatorV1alpha1Client, namespace string) *daprInstances {
|
||||
func newDaprInstances(c *OperatorV1beta1Client) *daprInstances {
|
||||
return &daprInstances{
|
||||
gentype.NewClientWithListAndApply[*v1alpha1.DaprInstance, *v1alpha1.DaprInstanceList, *operatorv1alpha1.DaprInstanceApplyConfiguration](
|
||||
gentype.NewClientWithListAndApply[*v1beta1.DaprInstance, *v1beta1.DaprInstanceList, *operatorv1beta1.DaprInstanceApplyConfiguration](
|
||||
"daprinstances",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
namespace,
|
||||
func() *v1alpha1.DaprInstance { return &v1alpha1.DaprInstance{} },
|
||||
func() *v1alpha1.DaprInstanceList { return &v1alpha1.DaprInstanceList{} }),
|
||||
"",
|
||||
func() *v1beta1.DaprInstance { return &v1beta1.DaprInstance{} },
|
||||
func() *v1beta1.DaprInstanceList { return &v1beta1.DaprInstanceList{} }),
|
||||
}
|
||||
}
|
|
@ -16,4 +16,4 @@ limitations under the License.
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1alpha1
|
||||
package v1beta1
|
|
@ -15,9 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
type DaprControlPlaneExpansion interface{}
|
||||
package v1beta1
|
||||
|
||||
type DaprCruiseControlExpansion interface{}
|
||||
|
|
@ -15,44 +15,39 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned/scheme"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type OperatorV1alpha1Interface interface {
|
||||
type OperatorV1beta1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
DaprControlPlanesGetter
|
||||
DaprCruiseControlsGetter
|
||||
DaprInstancesGetter
|
||||
}
|
||||
|
||||
// OperatorV1alpha1Client is used to interact with features provided by the operator.dapr.io group.
|
||||
type OperatorV1alpha1Client struct {
|
||||
// OperatorV1beta1Client is used to interact with features provided by the operator.dapr.io group.
|
||||
type OperatorV1beta1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *OperatorV1alpha1Client) DaprControlPlanes(namespace string) DaprControlPlaneInterface {
|
||||
return newDaprControlPlanes(c, namespace)
|
||||
func (c *OperatorV1beta1Client) DaprCruiseControls() DaprCruiseControlInterface {
|
||||
return newDaprCruiseControls(c)
|
||||
}
|
||||
|
||||
func (c *OperatorV1alpha1Client) DaprCruiseControls(namespace string) DaprCruiseControlInterface {
|
||||
return newDaprCruiseControls(c, namespace)
|
||||
func (c *OperatorV1beta1Client) DaprInstances() DaprInstanceInterface {
|
||||
return newDaprInstances(c)
|
||||
}
|
||||
|
||||
func (c *OperatorV1alpha1Client) DaprInstances(namespace string) DaprInstanceInterface {
|
||||
return newDaprInstances(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new OperatorV1alpha1Client for the given config.
|
||||
// NewForConfig creates a new OperatorV1beta1Client for the given config.
|
||||
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||
func NewForConfig(c *rest.Config) (*OperatorV1alpha1Client, error) {
|
||||
func NewForConfig(c *rest.Config) (*OperatorV1beta1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
|
@ -64,9 +59,9 @@ func NewForConfig(c *rest.Config) (*OperatorV1alpha1Client, error) {
|
|||
return NewForConfigAndClient(&config, httpClient)
|
||||
}
|
||||
|
||||
// NewForConfigAndClient creates a new OperatorV1alpha1Client for the given config and http client.
|
||||
// NewForConfigAndClient creates a new OperatorV1beta1Client for the given config and http client.
|
||||
// Note the http client provided takes precedence over the configured transport values.
|
||||
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*OperatorV1alpha1Client, error) {
|
||||
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*OperatorV1beta1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
|
@ -75,12 +70,12 @@ func NewForConfigAndClient(c *rest.Config, h *http.Client) (*OperatorV1alpha1Cli
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &OperatorV1alpha1Client{client}, nil
|
||||
return &OperatorV1beta1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new OperatorV1alpha1Client for the given config and
|
||||
// NewForConfigOrDie creates a new OperatorV1beta1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *OperatorV1alpha1Client {
|
||||
func NewForConfigOrDie(c *rest.Config) *OperatorV1beta1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -88,13 +83,13 @@ func NewForConfigOrDie(c *rest.Config) *OperatorV1alpha1Client {
|
|||
return client
|
||||
}
|
||||
|
||||
// New creates a new OperatorV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *OperatorV1alpha1Client {
|
||||
return &OperatorV1alpha1Client{c}
|
||||
// New creates a new OperatorV1beta1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *OperatorV1beta1Client {
|
||||
return &OperatorV1beta1Client{c}
|
||||
}
|
||||
|
||||
func setConfigDefaults(config *rest.Config) error {
|
||||
gv := v1alpha1.SchemeGroupVersion
|
||||
gv := v1beta1.SchemeGroupVersion
|
||||
config.GroupVersion = &gv
|
||||
config.APIPath = "/apis"
|
||||
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
|
||||
|
@ -108,7 +103,7 @@ func setConfigDefaults(config *rest.Config) error {
|
|||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *OperatorV1alpha1Client) RESTClient() rest.Interface {
|
||||
func (c *OperatorV1beta1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
|
@ -20,7 +20,7 @@ package externalversions
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
@ -51,13 +51,11 @@ func (f *genericInformer) Lister() cache.GenericLister {
|
|||
// TODO extend this to unknown resources with a client pool
|
||||
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
|
||||
switch resource {
|
||||
// Group=operator.dapr.io, Version=v1alpha1
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("daprcontrolplanes"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1alpha1().DaprControlPlanes().Informer()}, nil
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("daprcruisecontrols"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1alpha1().DaprCruiseControls().Informer()}, nil
|
||||
case v1alpha1.SchemeGroupVersion.WithResource("daprinstances"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1alpha1().DaprInstances().Informer()}, nil
|
||||
// Group=operator.dapr.io, Version=v1beta1
|
||||
case v1beta1.SchemeGroupVersion.WithResource("daprcruisecontrols"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1beta1().DaprCruiseControls().Informer()}, nil
|
||||
case v1beta1.SchemeGroupVersion.WithResource("daprinstances"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1beta1().DaprInstances().Informer()}, nil
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@ package operator
|
|||
|
||||
import (
|
||||
internalinterfaces "github.com/dapr/kubernetes-operator/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/informers/externalversions/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/pkg/client/informers/externalversions/operator/v1beta1"
|
||||
)
|
||||
|
||||
// Interface provides access to each of this group's versions.
|
||||
type Interface interface {
|
||||
// V1alpha1 provides access to shared informers for resources in V1alpha1.
|
||||
V1alpha1() v1alpha1.Interface
|
||||
// V1beta1 provides access to shared informers for resources in V1beta1.
|
||||
V1beta1() v1beta1.Interface
|
||||
}
|
||||
|
||||
type group struct {
|
||||
|
@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
|||
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// V1alpha1 returns a new v1alpha1.Interface.
|
||||
func (g *group) V1alpha1() v1alpha1.Interface {
|
||||
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
// V1beta1 returns a new v1beta1.Interface.
|
||||
func (g *group) V1beta1() v1beta1.Interface {
|
||||
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
|
||||
}
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
versioned "github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/dapr/kubernetes-operator/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/listers/operator/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// DaprControlPlaneInformer provides access to a shared informer and lister for
|
||||
// DaprControlPlanes.
|
||||
type DaprControlPlaneInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.DaprControlPlaneLister
|
||||
}
|
||||
|
||||
type daprControlPlaneInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewDaprControlPlaneInformer constructs a new informer for DaprControlPlane type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewDaprControlPlaneInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredDaprControlPlaneInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredDaprControlPlaneInformer constructs a new informer for DaprControlPlane type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredDaprControlPlaneInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OperatorV1alpha1().DaprControlPlanes(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OperatorV1alpha1().DaprControlPlanes(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&operatorv1alpha1.DaprControlPlane{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *daprControlPlaneInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredDaprControlPlaneInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *daprControlPlaneInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&operatorv1alpha1.DaprControlPlane{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *daprControlPlaneInformer) Lister() v1alpha1.DaprControlPlaneLister {
|
||||
return v1alpha1.NewDaprControlPlaneLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -15,16 +15,16 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
operatorv1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
versioned "github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/dapr/kubernetes-operator/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/listers/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/pkg/client/listers/operator/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
|
@ -35,55 +35,54 @@ import (
|
|||
// DaprCruiseControls.
|
||||
type DaprCruiseControlInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.DaprCruiseControlLister
|
||||
Lister() v1beta1.DaprCruiseControlLister
|
||||
}
|
||||
|
||||
type daprCruiseControlInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewDaprCruiseControlInformer constructs a new informer for DaprCruiseControl type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewDaprCruiseControlInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredDaprCruiseControlInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
func NewDaprCruiseControlInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredDaprCruiseControlInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredDaprCruiseControlInformer constructs a new informer for DaprCruiseControl type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredDaprCruiseControlInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
func NewFilteredDaprCruiseControlInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OperatorV1alpha1().DaprCruiseControls(namespace).List(context.TODO(), options)
|
||||
return client.OperatorV1beta1().DaprCruiseControls().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OperatorV1alpha1().DaprCruiseControls(namespace).Watch(context.TODO(), options)
|
||||
return client.OperatorV1beta1().DaprCruiseControls().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&operatorv1alpha1.DaprCruiseControl{},
|
||||
&operatorv1beta1.DaprCruiseControl{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *daprCruiseControlInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredDaprCruiseControlInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
return NewFilteredDaprCruiseControlInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *daprCruiseControlInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&operatorv1alpha1.DaprCruiseControl{}, f.defaultInformer)
|
||||
return f.factory.InformerFor(&operatorv1beta1.DaprCruiseControl{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *daprCruiseControlInformer) Lister() v1alpha1.DaprCruiseControlLister {
|
||||
return v1alpha1.NewDaprCruiseControlLister(f.Informer().GetIndexer())
|
||||
func (f *daprCruiseControlInformer) Lister() v1beta1.DaprCruiseControlLister {
|
||||
return v1beta1.NewDaprCruiseControlLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -15,16 +15,16 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
operatorv1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
operatorv1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
versioned "github.com/dapr/kubernetes-operator/pkg/client/clientset/versioned"
|
||||
internalinterfaces "github.com/dapr/kubernetes-operator/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/pkg/client/listers/operator/v1alpha1"
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/pkg/client/listers/operator/v1beta1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
|
@ -35,55 +35,54 @@ import (
|
|||
// DaprInstances.
|
||||
type DaprInstanceInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.DaprInstanceLister
|
||||
Lister() v1beta1.DaprInstanceLister
|
||||
}
|
||||
|
||||
type daprInstanceInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewDaprInstanceInformer constructs a new informer for DaprInstance type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewDaprInstanceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredDaprInstanceInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
func NewDaprInstanceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredDaprInstanceInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredDaprInstanceInformer constructs a new informer for DaprInstance type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredDaprInstanceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
func NewFilteredDaprInstanceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OperatorV1alpha1().DaprInstances(namespace).List(context.TODO(), options)
|
||||
return client.OperatorV1beta1().DaprInstances().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.OperatorV1alpha1().DaprInstances(namespace).Watch(context.TODO(), options)
|
||||
return client.OperatorV1beta1().DaprInstances().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&operatorv1alpha1.DaprInstance{},
|
||||
&operatorv1beta1.DaprInstance{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *daprInstanceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredDaprInstanceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
return NewFilteredDaprInstanceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *daprInstanceInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&operatorv1alpha1.DaprInstance{}, f.defaultInformer)
|
||||
return f.factory.InformerFor(&operatorv1beta1.DaprInstance{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *daprInstanceInformer) Lister() v1alpha1.DaprInstanceLister {
|
||||
return v1alpha1.NewDaprInstanceLister(f.Informer().GetIndexer())
|
||||
func (f *daprInstanceInformer) Lister() v1beta1.DaprInstanceLister {
|
||||
return v1beta1.NewDaprInstanceLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
internalinterfaces "github.com/dapr/kubernetes-operator/pkg/client/informers/externalversions/internalinterfaces"
|
||||
|
@ -23,8 +23,6 @@ import (
|
|||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// DaprControlPlanes returns a DaprControlPlaneInformer.
|
||||
DaprControlPlanes() DaprControlPlaneInformer
|
||||
// DaprCruiseControls returns a DaprCruiseControlInformer.
|
||||
DaprCruiseControls() DaprCruiseControlInformer
|
||||
// DaprInstances returns a DaprInstanceInformer.
|
||||
|
@ -42,17 +40,12 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
|||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// DaprControlPlanes returns a DaprControlPlaneInformer.
|
||||
func (v *version) DaprControlPlanes() DaprControlPlaneInformer {
|
||||
return &daprControlPlaneInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// DaprCruiseControls returns a DaprCruiseControlInformer.
|
||||
func (v *version) DaprCruiseControls() DaprCruiseControlInformer {
|
||||
return &daprCruiseControlInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
return &daprCruiseControlInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// DaprInstances returns a DaprInstanceInformer.
|
||||
func (v *version) DaprInstances() DaprInstanceInformer {
|
||||
return &daprInstanceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
return &daprInstanceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// DaprControlPlaneLister helps list DaprControlPlanes.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DaprControlPlaneLister interface {
|
||||
// List lists all DaprControlPlanes in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.DaprControlPlane, err error)
|
||||
// DaprControlPlanes returns an object that can list and get DaprControlPlanes.
|
||||
DaprControlPlanes(namespace string) DaprControlPlaneNamespaceLister
|
||||
DaprControlPlaneListerExpansion
|
||||
}
|
||||
|
||||
// daprControlPlaneLister implements the DaprControlPlaneLister interface.
|
||||
type daprControlPlaneLister struct {
|
||||
listers.ResourceIndexer[*v1alpha1.DaprControlPlane]
|
||||
}
|
||||
|
||||
// NewDaprControlPlaneLister returns a new DaprControlPlaneLister.
|
||||
func NewDaprControlPlaneLister(indexer cache.Indexer) DaprControlPlaneLister {
|
||||
return &daprControlPlaneLister{listers.New[*v1alpha1.DaprControlPlane](indexer, v1alpha1.Resource("daprcontrolplane"))}
|
||||
}
|
||||
|
||||
// DaprControlPlanes returns an object that can list and get DaprControlPlanes.
|
||||
func (s *daprControlPlaneLister) DaprControlPlanes(namespace string) DaprControlPlaneNamespaceLister {
|
||||
return daprControlPlaneNamespaceLister{listers.NewNamespaced[*v1alpha1.DaprControlPlane](s.ResourceIndexer, namespace)}
|
||||
}
|
||||
|
||||
// DaprControlPlaneNamespaceLister helps list and get DaprControlPlanes.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DaprControlPlaneNamespaceLister interface {
|
||||
// List lists all DaprControlPlanes in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.DaprControlPlane, err error)
|
||||
// Get retrieves the DaprControlPlane from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1alpha1.DaprControlPlane, error)
|
||||
DaprControlPlaneNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// daprControlPlaneNamespaceLister implements the DaprControlPlaneNamespaceLister
|
||||
// interface.
|
||||
type daprControlPlaneNamespaceLister struct {
|
||||
listers.ResourceIndexer[*v1alpha1.DaprControlPlane]
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// DaprCruiseControlLister helps list DaprCruiseControls.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DaprCruiseControlLister interface {
|
||||
// List lists all DaprCruiseControls in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.DaprCruiseControl, err error)
|
||||
// DaprCruiseControls returns an object that can list and get DaprCruiseControls.
|
||||
DaprCruiseControls(namespace string) DaprCruiseControlNamespaceLister
|
||||
DaprCruiseControlListerExpansion
|
||||
}
|
||||
|
||||
// daprCruiseControlLister implements the DaprCruiseControlLister interface.
|
||||
type daprCruiseControlLister struct {
|
||||
listers.ResourceIndexer[*v1alpha1.DaprCruiseControl]
|
||||
}
|
||||
|
||||
// NewDaprCruiseControlLister returns a new DaprCruiseControlLister.
|
||||
func NewDaprCruiseControlLister(indexer cache.Indexer) DaprCruiseControlLister {
|
||||
return &daprCruiseControlLister{listers.New[*v1alpha1.DaprCruiseControl](indexer, v1alpha1.Resource("daprcruisecontrol"))}
|
||||
}
|
||||
|
||||
// DaprCruiseControls returns an object that can list and get DaprCruiseControls.
|
||||
func (s *daprCruiseControlLister) DaprCruiseControls(namespace string) DaprCruiseControlNamespaceLister {
|
||||
return daprCruiseControlNamespaceLister{listers.NewNamespaced[*v1alpha1.DaprCruiseControl](s.ResourceIndexer, namespace)}
|
||||
}
|
||||
|
||||
// DaprCruiseControlNamespaceLister helps list and get DaprCruiseControls.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DaprCruiseControlNamespaceLister interface {
|
||||
// List lists all DaprCruiseControls in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.DaprCruiseControl, err error)
|
||||
// Get retrieves the DaprCruiseControl from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1alpha1.DaprCruiseControl, error)
|
||||
DaprCruiseControlNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// daprCruiseControlNamespaceLister implements the DaprCruiseControlNamespaceLister
|
||||
// interface.
|
||||
type daprCruiseControlNamespaceLister struct {
|
||||
listers.ResourceIndexer[*v1alpha1.DaprCruiseControl]
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// DaprInstanceLister helps list DaprInstances.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DaprInstanceLister interface {
|
||||
// List lists all DaprInstances in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.DaprInstance, err error)
|
||||
// DaprInstances returns an object that can list and get DaprInstances.
|
||||
DaprInstances(namespace string) DaprInstanceNamespaceLister
|
||||
DaprInstanceListerExpansion
|
||||
}
|
||||
|
||||
// daprInstanceLister implements the DaprInstanceLister interface.
|
||||
type daprInstanceLister struct {
|
||||
listers.ResourceIndexer[*v1alpha1.DaprInstance]
|
||||
}
|
||||
|
||||
// NewDaprInstanceLister returns a new DaprInstanceLister.
|
||||
func NewDaprInstanceLister(indexer cache.Indexer) DaprInstanceLister {
|
||||
return &daprInstanceLister{listers.New[*v1alpha1.DaprInstance](indexer, v1alpha1.Resource("daprinstance"))}
|
||||
}
|
||||
|
||||
// DaprInstances returns an object that can list and get DaprInstances.
|
||||
func (s *daprInstanceLister) DaprInstances(namespace string) DaprInstanceNamespaceLister {
|
||||
return daprInstanceNamespaceLister{listers.NewNamespaced[*v1alpha1.DaprInstance](s.ResourceIndexer, namespace)}
|
||||
}
|
||||
|
||||
// DaprInstanceNamespaceLister helps list and get DaprInstances.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DaprInstanceNamespaceLister interface {
|
||||
// List lists all DaprInstances in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.DaprInstance, err error)
|
||||
// Get retrieves the DaprInstance from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1alpha1.DaprInstance, error)
|
||||
DaprInstanceNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// daprInstanceNamespaceLister implements the DaprInstanceNamespaceLister
|
||||
// interface.
|
||||
type daprInstanceNamespaceLister struct {
|
||||
listers.ResourceIndexer[*v1alpha1.DaprInstance]
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// DaprCruiseControlLister helps list DaprCruiseControls.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DaprCruiseControlLister interface {
|
||||
// List lists all DaprCruiseControls in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1beta1.DaprCruiseControl, err error)
|
||||
// Get retrieves the DaprCruiseControl from the index for a given name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1beta1.DaprCruiseControl, error)
|
||||
DaprCruiseControlListerExpansion
|
||||
}
|
||||
|
||||
// daprCruiseControlLister implements the DaprCruiseControlLister interface.
|
||||
type daprCruiseControlLister struct {
|
||||
listers.ResourceIndexer[*v1beta1.DaprCruiseControl]
|
||||
}
|
||||
|
||||
// NewDaprCruiseControlLister returns a new DaprCruiseControlLister.
|
||||
func NewDaprCruiseControlLister(indexer cache.Indexer) DaprCruiseControlLister {
|
||||
return &daprCruiseControlLister{listers.New[*v1beta1.DaprCruiseControl](indexer, v1beta1.Resource("daprcruisecontrol"))}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
Copyright 2023.
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/listers"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// DaprInstanceLister helps list DaprInstances.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DaprInstanceLister interface {
|
||||
// List lists all DaprInstances in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1beta1.DaprInstance, err error)
|
||||
// Get retrieves the DaprInstance from the index for a given name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1beta1.DaprInstance, error)
|
||||
DaprInstanceListerExpansion
|
||||
}
|
||||
|
||||
// daprInstanceLister implements the DaprInstanceLister interface.
|
||||
type daprInstanceLister struct {
|
||||
listers.ResourceIndexer[*v1beta1.DaprInstance]
|
||||
}
|
||||
|
||||
// NewDaprInstanceLister returns a new DaprInstanceLister.
|
||||
func NewDaprInstanceLister(indexer cache.Indexer) DaprInstanceLister {
|
||||
return &daprInstanceLister{listers.New[*v1beta1.DaprInstance](indexer, v1beta1.Resource("daprinstance"))}
|
||||
}
|
|
@ -15,28 +15,12 @@ limitations under the License.
|
|||
*/
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// DaprControlPlaneListerExpansion allows custom methods to be added to
|
||||
// DaprControlPlaneLister.
|
||||
type DaprControlPlaneListerExpansion interface{}
|
||||
|
||||
// DaprControlPlaneNamespaceListerExpansion allows custom methods to be added to
|
||||
// DaprControlPlaneNamespaceLister.
|
||||
type DaprControlPlaneNamespaceListerExpansion interface{}
|
||||
package v1beta1
|
||||
|
||||
// DaprCruiseControlListerExpansion allows custom methods to be added to
|
||||
// DaprCruiseControlLister.
|
||||
type DaprCruiseControlListerExpansion interface{}
|
||||
|
||||
// DaprCruiseControlNamespaceListerExpansion allows custom methods to be added to
|
||||
// DaprCruiseControlNamespaceLister.
|
||||
type DaprCruiseControlNamespaceListerExpansion interface{}
|
||||
|
||||
// DaprInstanceListerExpansion allows custom methods to be added to
|
||||
// DaprInstanceLister.
|
||||
type DaprInstanceListerExpansion interface{}
|
||||
|
||||
// DaprInstanceNamespaceListerExpansion allows custom methods to be added to
|
||||
// DaprInstanceNamespaceLister.
|
||||
type DaprInstanceNamespaceListerExpansion interface{}
|
|
@ -6,6 +6,7 @@ const (
|
|||
TypeError = "Error"
|
||||
ReasonReady = "Ready"
|
||||
ReasonReconciled = "Ready"
|
||||
ReasonInProgress = "InProgress"
|
||||
ReasonFailure = "Failure"
|
||||
ReasonUnsupportedConfiguration = "UnsupportedConfiguration"
|
||||
)
|
||||
|
|
|
@ -118,13 +118,11 @@ func newRESTClientForConfig(config *rest.Config) (*rest.RESTClient, error) {
|
|||
return rc, nil
|
||||
}
|
||||
|
||||
func (c *Client) Dynamic(namespace string, obj *unstructured.Unstructured) (dynamic.ResourceInterface, error) {
|
||||
func (c *Client) Dynamic(obj *unstructured.Unstructured) (ResourceInterface, error) {
|
||||
if c.discoveryLimiter.Allow() {
|
||||
c.discoveryCache.Invalidate()
|
||||
}
|
||||
|
||||
c.discoveryCache.Fresh()
|
||||
|
||||
mapping, err := c.mapper.RESTMapping(obj.GroupVersionKind().GroupKind(), obj.GroupVersionKind().Version)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(
|
||||
|
@ -134,19 +132,28 @@ func (c *Client) Dynamic(namespace string, obj *unstructured.Unstructured) (dyna
|
|||
err)
|
||||
}
|
||||
|
||||
var dr dynamic.ResourceInterface
|
||||
|
||||
if mapping.Scope.Name() == meta.RESTScopeNameNamespace {
|
||||
dr = &NamespacedResource{
|
||||
ResourceInterface: c.dynamic.Resource(mapping.Resource).Namespace(namespace),
|
||||
switch mapping.Scope {
|
||||
case meta.RESTScopeNamespace:
|
||||
if obj.GetNamespace() == "" {
|
||||
//nolint:err113
|
||||
return nil, fmt.Errorf(
|
||||
"missing required filed: namespace, gvks=%s, name=%s",
|
||||
obj.GetObjectKind().GroupVersionKind().String(),
|
||||
obj.GetName())
|
||||
}
|
||||
} else {
|
||||
dr = &ClusteredResource{
|
||||
|
||||
dr := &NamespacedResource{
|
||||
ResourceInterface: c.dynamic.Resource(mapping.Resource).Namespace(obj.GetNamespace()),
|
||||
}
|
||||
|
||||
return dr, nil
|
||||
default:
|
||||
dr := &ClusteredResource{
|
||||
ResourceInterface: c.dynamic.Resource(mapping.Resource),
|
||||
}
|
||||
}
|
||||
|
||||
return dr, nil
|
||||
return dr, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) Invalidate() {
|
||||
|
|
|
@ -2,10 +2,31 @@ package client
|
|||
|
||||
import "k8s.io/client-go/dynamic"
|
||||
|
||||
type ResourceScope string
|
||||
|
||||
const (
|
||||
ResourceScopeNamespace ResourceScope = "namespace"
|
||||
ResourceScopeCluster ResourceScope = "cluster"
|
||||
)
|
||||
|
||||
type ResourceInterface interface {
|
||||
dynamic.ResourceInterface
|
||||
|
||||
Scope() ResourceScope
|
||||
}
|
||||
|
||||
type NamespacedResource struct {
|
||||
dynamic.ResourceInterface
|
||||
}
|
||||
|
||||
func (r *NamespacedResource) Scope() ResourceScope {
|
||||
return ResourceScopeNamespace
|
||||
}
|
||||
|
||||
type ClusteredResource struct {
|
||||
dynamic.ResourceInterface
|
||||
}
|
||||
|
||||
func (r *ClusteredResource) Scope() ResourceScope {
|
||||
return ResourceScopeCluster
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ func Start(options Options, setup func(manager.Manager, Options) error) error {
|
|||
LeaderElectionReleaseOnCancel: options.ReleaseLeaderElectionOnCancel,
|
||||
LeaderElectionNamespace: options.LeaderElectionNamespace,
|
||||
PprofBindAddress: options.PprofAddr,
|
||||
Logger: options.Logger,
|
||||
|
||||
Metrics: metricsserver.Options{
|
||||
BindAddress: options.MetricsAddr,
|
||||
|
@ -85,8 +86,6 @@ func Start(options Options, setup func(manager.Manager, Options) error) error {
|
|||
}
|
||||
|
||||
func OperatorNamespace() string {
|
||||
// by default, the controller expect singleton resources to be created in the same
|
||||
// namespace where it runs, if not fallback to the default namespace
|
||||
ns := os.Getenv(NamespaceEnv)
|
||||
if ns == "" {
|
||||
ns = NamespaceDefault
|
||||
|
|
|
@ -80,7 +80,7 @@ func (gc *GC) deleteEachOf(
|
|||
|
||||
if err := c.List(ctx, &items, options...); err != nil {
|
||||
if k8serrors.IsForbidden(err) {
|
||||
gc.l.Info("cannot gc, forbidden", "gvk", GVK.String())
|
||||
gc.l.Info("cannot gc, forbidden", "gvks", GVK.String())
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ func (gc *GC) delete(
|
|||
}
|
||||
|
||||
return false, fmt.Errorf(
|
||||
"cannot delete resources gvk:%s, namespace: %s, name: %s, err: %w",
|
||||
"cannot delete resources gvks:%s, namespace: %s, name: %s, err: %w",
|
||||
resource.GroupVersionKind().String(),
|
||||
resource.GetNamespace(),
|
||||
resource.GetName(),
|
||||
|
|
|
@ -3,7 +3,9 @@ package predicates
|
|||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/wI2L/jsondiff"
|
||||
"github.com/dapr/kubernetes-operator/pkg/resources"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"sigs.k8s.io/controller-runtime/pkg/event"
|
||||
|
@ -58,15 +60,14 @@ func (p DependentPredicate) Delete(e event.DeleteEvent) bool {
|
|||
|
||||
o, ok := e.Object.(*unstructured.Unstructured)
|
||||
if !ok {
|
||||
log.Error(nil, "unexpected object type", "gvk", e.Object.GetObjectKind().GroupVersionKind().String())
|
||||
log.Error(nil, "unexpected object type", "gvks", e.Object.GetObjectKind().GroupVersionKind().String())
|
||||
return false
|
||||
}
|
||||
|
||||
log.Info("Reconciling due to dependent resource deletion",
|
||||
"name", o.GetName(),
|
||||
"namespace", o.GetNamespace(),
|
||||
"apiVersion", o.GroupVersionKind().GroupVersion(),
|
||||
"kind", o.GroupVersionKind().Kind)
|
||||
log.Info(
|
||||
"Reconciling due to dependent resource delete",
|
||||
"ref", resources.Ref(o),
|
||||
"partial", false)
|
||||
|
||||
return true
|
||||
}
|
||||
|
@ -82,13 +83,13 @@ func (p DependentPredicate) Update(e event.UpdateEvent) bool {
|
|||
|
||||
oldObj, ok := e.ObjectOld.(*unstructured.Unstructured)
|
||||
if !ok {
|
||||
log.Error(nil, "unexpected old object type", "gvk", e.ObjectOld.GetObjectKind().GroupVersionKind().String())
|
||||
log.Error(nil, "unexpected old object type", "gvks", e.ObjectOld.GetObjectKind().GroupVersionKind().String())
|
||||
return false
|
||||
}
|
||||
|
||||
newObj, ok := e.ObjectNew.(*unstructured.Unstructured)
|
||||
if !ok {
|
||||
log.Error(nil, "unexpected new object type", "gvk", e.ObjectOld.GetObjectKind().GroupVersionKind().String())
|
||||
log.Error(nil, "unexpected new object type", "gvks", e.ObjectOld.GetObjectKind().GroupVersionKind().String())
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -113,18 +114,85 @@ func (p DependentPredicate) Update(e event.UpdateEvent) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
patch, err := jsondiff.Compare(oldObj, newObj)
|
||||
if err != nil {
|
||||
log.Error(err, "failed to generate diff")
|
||||
return true
|
||||
}
|
||||
|
||||
log.Info("Reconciling due to dependent resource update",
|
||||
"name", newObj.GetName(),
|
||||
"namespace", newObj.GetNamespace(),
|
||||
"apiVersion", newObj.GroupVersionKind().GroupVersion(),
|
||||
"kind", newObj.GroupVersionKind().Kind,
|
||||
"diff", patch.String())
|
||||
log.Info(
|
||||
"Reconciling due to dependent resource update",
|
||||
"ref", resources.Ref(newObj),
|
||||
"partial", false)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
var _ predicate.Predicate = PartialDependentPredicate{}
|
||||
|
||||
type PartialDependentPredicateOption func(*PartialDependentPredicate) *PartialDependentPredicate
|
||||
|
||||
func PartialWatchDeleted(val bool) PartialDependentPredicateOption {
|
||||
return func(in *PartialDependentPredicate) *PartialDependentPredicate {
|
||||
in.WatchDelete = val
|
||||
return in
|
||||
}
|
||||
}
|
||||
|
||||
func PartialWatchUpdate(val bool) PartialDependentPredicateOption {
|
||||
return func(in *PartialDependentPredicate) *PartialDependentPredicate {
|
||||
in.WatchUpdate = val
|
||||
return in
|
||||
}
|
||||
}
|
||||
|
||||
type PartialDependentPredicate struct {
|
||||
WatchDelete bool
|
||||
WatchUpdate bool
|
||||
|
||||
predicate.Funcs
|
||||
}
|
||||
|
||||
func (p PartialDependentPredicate) Create(event.CreateEvent) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p PartialDependentPredicate) Generic(event.GenericEvent) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p PartialDependentPredicate) Delete(e event.DeleteEvent) bool {
|
||||
if !p.WatchDelete {
|
||||
return false
|
||||
}
|
||||
|
||||
o, ok := e.Object.(*metav1.PartialObjectMetadata)
|
||||
if !ok {
|
||||
log.Error(nil, "unexpected object type", "gvks", e.Object.GetObjectKind().GroupVersionKind().String())
|
||||
return false
|
||||
}
|
||||
|
||||
log.Info(
|
||||
"Reconciling due to dependent resource delete",
|
||||
"ref", resources.Ref(o),
|
||||
"partial", true)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (p PartialDependentPredicate) Update(e event.UpdateEvent) bool {
|
||||
if !p.WatchUpdate {
|
||||
return false
|
||||
}
|
||||
|
||||
if e.ObjectOld.GetResourceVersion() == e.ObjectNew.GetResourceVersion() {
|
||||
return false
|
||||
}
|
||||
|
||||
newObj, ok := e.ObjectNew.(*metav1.PartialObjectMetadata)
|
||||
if !ok {
|
||||
log.Error(nil, "unexpected new object type", "gvks", e.ObjectNew.GetObjectKind().GroupVersionKind().String())
|
||||
return false
|
||||
}
|
||||
|
||||
log.Info(
|
||||
"Reconciling due to dependent resource update",
|
||||
"ref", resources.Ref(newObj),
|
||||
"partial", true)
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@ func RemoveFinalizer(ctx context.Context, client ctrlClient.Client, o ctrlClient
|
|||
type BaseReconciler[T controller.ResourceObject] struct {
|
||||
Log logr.Logger
|
||||
Name string
|
||||
Namespace string
|
||||
FinalizerName string
|
||||
FinalizerAction func(ctx context.Context, res T) error
|
||||
Delegate reconcile.ObjectReconciler[T]
|
||||
|
@ -83,7 +82,7 @@ func (s *BaseReconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (ct
|
|||
return ctrl.Result{}, ctrlClient.IgnoreNotFound(err)
|
||||
}
|
||||
|
||||
if res.GetName() != s.Name || res.GetNamespace() != s.Namespace {
|
||||
if res.GetName() != s.Name {
|
||||
res.GetStatus().Phase = conditions.TypeError
|
||||
|
||||
meta.SetStatusCondition(&res.GetStatus().Conditions, metav1.Condition{
|
||||
|
@ -91,10 +90,9 @@ func (s *BaseReconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (ct
|
|||
Status: metav1.ConditionFalse,
|
||||
Reason: conditions.ReasonUnsupportedConfiguration,
|
||||
Message: fmt.Sprintf(
|
||||
"Unsupported resource, the operator handles a single %s resource named %s in namespace %s",
|
||||
"Unsupported resource, the operator handles a single %s resource named %s",
|
||||
res.GetObjectKind().GroupVersionKind().String(),
|
||||
s.Name,
|
||||
s.Namespace),
|
||||
s.Name),
|
||||
})
|
||||
|
||||
err := s.Client.Status().Update(ctx, res)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package controller
|
||||
|
||||
import (
|
||||
daptCtrlApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daptCtrlApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"github.com/go-logr/logr"
|
||||
rtcache "sigs.k8s.io/controller-runtime/pkg/cache"
|
||||
rtclient "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
@ -26,6 +27,7 @@ type Options struct {
|
|||
EnableLeaderElection bool
|
||||
ReleaseLeaderElectionOnCancel bool
|
||||
WatchSelectors map[rtclient.Object]rtcache.ByObject
|
||||
Logger logr.Logger
|
||||
}
|
||||
|
||||
type WithStatus interface {
|
||||
|
|
|
@ -13,79 +13,76 @@ import (
|
|||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||
return map[string]common.OpenAPIDefinition{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartMeta": schema_kubernetes_operator_api_operator_v1alpha1_ChartMeta(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartSpec": schema_kubernetes_operator_api_operator_v1alpha1_ChartSpec(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlane": schema_kubernetes_operator_api_operator_v1alpha1_DaprControlPlane(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlaneList": schema_kubernetes_operator_api_operator_v1alpha1_DaprControlPlaneList(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlaneSpec": schema_kubernetes_operator_api_operator_v1alpha1_DaprControlPlaneSpec(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlaneStatus": schema_kubernetes_operator_api_operator_v1alpha1_DaprControlPlaneStatus(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControl": schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControl(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControlList": schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlList(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControlSpec": schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlSpec(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControlStatus": schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlStatus(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstance": schema_kubernetes_operator_api_operator_v1alpha1_DaprInstance(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstanceList": schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceList(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstanceSpec": schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceSpec(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstanceStatus": schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceStatus(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.JSON": schema_kubernetes_operator_api_operator_v1alpha1_JSON(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.Status": schema_kubernetes_operator_api_operator_v1alpha1_Status(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref),
|
||||
"k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref),
|
||||
"k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref),
|
||||
"k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref),
|
||||
"k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.ChartMeta": schema_kubernetes_operator_api_operator_v1beta1_ChartMeta(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.ChartSpec": schema_kubernetes_operator_api_operator_v1beta1_ChartSpec(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControl": schema_kubernetes_operator_api_operator_v1beta1_DaprCruiseControl(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControlList": schema_kubernetes_operator_api_operator_v1beta1_DaprCruiseControlList(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControlSpec": schema_kubernetes_operator_api_operator_v1beta1_DaprCruiseControlSpec(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControlStatus": schema_kubernetes_operator_api_operator_v1beta1_DaprCruiseControlStatus(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstance": schema_kubernetes_operator_api_operator_v1beta1_DaprInstance(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstanceList": schema_kubernetes_operator_api_operator_v1beta1_DaprInstanceList(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstanceSpec": schema_kubernetes_operator_api_operator_v1beta1_DaprInstanceSpec(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstanceStatus": schema_kubernetes_operator_api_operator_v1beta1_DaprInstanceStatus(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DeploymentSpec": schema_kubernetes_operator_api_operator_v1beta1_DeploymentSpec(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.JSON": schema_kubernetes_operator_api_operator_v1beta1_JSON(ref),
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.Status": schema_kubernetes_operator_api_operator_v1beta1_Status(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref),
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref),
|
||||
"k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref),
|
||||
"k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref),
|
||||
"k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref),
|
||||
"k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref),
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_ChartMeta(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_ChartMeta(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -115,7 +112,7 @@ func schema_kubernetes_operator_api_operator_v1alpha1_ChartMeta(ref common.Refer
|
|||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_ChartSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_ChartSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -151,167 +148,7 @@ func schema_kubernetes_operator_api_operator_v1alpha1_ChartSpec(ref common.Refer
|
|||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprControlPlane(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlaneSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlaneStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlaneSpec", "github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlaneStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprControlPlaneList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlane"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprControlPlane", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprControlPlaneSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"values": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.JSON"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"values"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.JSON"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprControlPlaneStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"phase": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"conditions": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"observedGeneration": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"integer"},
|
||||
Format: "int64",
|
||||
},
|
||||
},
|
||||
"chart": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartMeta"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"phase"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControl(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DaprCruiseControl(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -341,24 +178,24 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControl(ref comm
|
|||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControlSpec"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControlSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControlStatus"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControlStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControlSpec", "github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControlStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControlSpec", "github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControlStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DaprCruiseControlList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -392,7 +229,7 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlList(ref
|
|||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControl"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControl"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -403,11 +240,11 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlList(ref
|
|||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprCruiseControl", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprCruiseControl", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DaprCruiseControlSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -418,7 +255,7 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlSpec(ref
|
|||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DaprCruiseControlStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -453,7 +290,7 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlStatus(re
|
|||
},
|
||||
"chart": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartMeta"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.ChartMeta"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -461,11 +298,11 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprCruiseControlStatus(re
|
|||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.ChartMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstance(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DaprInstance(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -495,24 +332,24 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstance(ref common.Re
|
|||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstanceSpec"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstanceSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstanceStatus"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstanceStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstanceSpec", "github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstanceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstanceSpec", "github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstanceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DaprInstanceList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -546,7 +383,7 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceList(ref commo
|
|||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstance"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstance"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -557,37 +394,43 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceList(ref commo
|
|||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.DaprInstance", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.DaprInstance", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DaprInstanceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DaprInstanceSpec defines the desired state of DaprInstance.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"deployment": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.DeploymentSpec"),
|
||||
},
|
||||
},
|
||||
"chart": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartSpec"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.ChartSpec"),
|
||||
},
|
||||
},
|
||||
"values": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.JSON"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.JSON"),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"values"},
|
||||
Required: []string{"deployment", "values"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartSpec", "github.com/dapr/kubernetes-operator/api/operator/v1alpha1.JSON"},
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.ChartSpec", "github.com/dapr/kubernetes-operator/api/operator/v1beta1.DeploymentSpec", "github.com/dapr/kubernetes-operator/api/operator/v1beta1.JSON"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DaprInstanceStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -622,7 +465,7 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceStatus(ref com
|
|||
},
|
||||
"chart": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartMeta"),
|
||||
Ref: ref("github.com/dapr/kubernetes-operator/api/operator/v1beta1.ChartMeta"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -630,11 +473,30 @@ func schema_kubernetes_operator_api_operator_v1alpha1_DaprInstanceStatus(ref com
|
|||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1alpha1.ChartMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
|
||||
"github.com/dapr/kubernetes-operator/api/operator/v1beta1.ChartMeta", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_JSON(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_DeploymentSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"namespace": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Namespace represent the target namespace where the Dapr resources will be installed",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_JSON(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
@ -645,7 +507,7 @@ func schema_kubernetes_operator_api_operator_v1alpha1_JSON(ref common.ReferenceC
|
|||
}
|
||||
}
|
||||
|
||||
func schema_kubernetes_operator_api_operator_v1alpha1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_kubernetes_operator_api_operator_v1beta1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package gvks
|
||||
|
||||
import (
|
||||
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
var CustomResourceDefinition = schema.GroupVersionKind{
|
||||
Group: apiextensions.GroupName,
|
||||
Version: "v1",
|
||||
Kind: "CustomResourceDefinition",
|
||||
}
|
||||
|
||||
var Secret = schema.GroupVersionKind{
|
||||
Group: corev1.GroupName,
|
||||
Version: "v1",
|
||||
Kind: "Secret",
|
||||
}
|
||||
|
||||
var Deployment = schema.GroupVersionKind{
|
||||
Group: appsv1.GroupName,
|
||||
Version: "v1",
|
||||
Kind: "Deployment",
|
||||
}
|
||||
|
||||
var StatefulSet = schema.GroupVersionKind{
|
||||
Group: appsv1.GroupName,
|
||||
Version: "v1",
|
||||
Kind: "StatefulSet",
|
||||
}
|
||||
|
||||
var MutatingWebhookConfiguration = schema.GroupVersionKind{
|
||||
Group: admissionregistrationv1.GroupName,
|
||||
Version: "v1",
|
||||
Kind: "MutatingWebhookConfiguration",
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package helm
|
||||
|
||||
import (
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
helme "github.com/lburgazzoli/k8s-manifests-renderer-helm/engine"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/selection"
|
||||
|
@ -10,7 +10,6 @@ import (
|
|||
const (
|
||||
ReleaseGeneration = "helm.operator.dapr.io/release.generation"
|
||||
ReleaseName = "helm.operator.dapr.io/release.name"
|
||||
ReleaseNamespace = "helm.operator.dapr.io/release.namespace"
|
||||
ReleaseVersion = "helm.operator.dapr.io/release.version"
|
||||
|
||||
ChartsDir = "helm-charts/dapr"
|
||||
|
@ -27,14 +26,8 @@ func ReleaseSelector() (labels.Selector, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
hasReleaseNamespaceLabel, err := labels.NewRequirement(ReleaseNamespace, selection.Exists, []string{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
selector := labels.NewSelector().
|
||||
Add(*hasReleaseNameLabel).
|
||||
Add(*hasReleaseNamespaceLabel)
|
||||
Add(*hasReleaseNameLabel)
|
||||
|
||||
return selector, nil
|
||||
}
|
||||
|
|
|
@ -74,17 +74,21 @@ func Label(target *unstructured.Unstructured, key string) string {
|
|||
|
||||
func Ref(obj client.Object) string {
|
||||
name := obj.GetName()
|
||||
if obj.GetNamespace() == "" {
|
||||
name = obj.GetNamespace() + ":" + obj.GetName()
|
||||
if obj.GetNamespace() != "" {
|
||||
name = obj.GetNamespace() + "/" + obj.GetName()
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"%s:%s:%s",
|
||||
obj.GetObjectKind().GroupVersionKind().Kind,
|
||||
obj.GetObjectKind().GroupVersionKind().GroupVersion().String(),
|
||||
obj.GetObjectKind().GroupVersionKind().Kind,
|
||||
name,
|
||||
)
|
||||
}
|
||||
func GvkRef(obj client.Object) string {
|
||||
gvk := obj.GetObjectKind().GroupVersionKind()
|
||||
return gvk.GroupVersion().String() + ":" + gvk.Kind
|
||||
}
|
||||
|
||||
func ToUnstructured(s *runtime.Scheme, obj runtime.Object) (*unstructured.Unstructured, error) {
|
||||
switch ot := obj.(type) {
|
||||
|
|
|
@ -4,14 +4,10 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/controlplane"
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/instance"
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
"github.com/dapr/kubernetes-operator/test/support/dapr"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/test/support/olm"
|
||||
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1beta1"
|
||||
daprTC "github.com/dapr/kubernetes-operator/test/e2e/common"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
@ -21,53 +17,7 @@ import (
|
|||
)
|
||||
|
||||
func TestDaprDeploy(t *testing.T) {
|
||||
t.Run("With ControlPlane", func(t *testing.T) {
|
||||
testDaprDeploy(
|
||||
With(t),
|
||||
func(test Test, ns *corev1.Namespace) client.Object {
|
||||
return dapr.DeployControlPlane(
|
||||
test,
|
||||
daprAc.DaprControlPlaneSpec().
|
||||
WithValues(dapr.Values(test, map[string]interface{}{
|
||||
// enable pod watchdog as sometimes the sidecar for some
|
||||
// (yet) unknown reason is not injected when the pod is
|
||||
// created, hence the dapr app won't properly start up
|
||||
"dapr_operator": map[string]interface{}{
|
||||
"watchInterval": "1s",
|
||||
},
|
||||
})),
|
||||
dapr.WithControlPlaneName(controlplane.DaprControlPlaneResourceName),
|
||||
dapr.WithControlPlaneNamespace(ns.Name),
|
||||
)
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("With Instance", func(t *testing.T) {
|
||||
testDaprDeploy(
|
||||
With(t),
|
||||
func(test Test, ns *corev1.Namespace) client.Object {
|
||||
return dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithValues(dapr.Values(test, map[string]interface{}{
|
||||
// enable pod watchdog as sometimes the sidecar for some
|
||||
// (yet) unknown reason is not injected when the pod is
|
||||
// created, hence the dapr app won't properly start up
|
||||
"dapr_operator": map[string]interface{}{
|
||||
"watchInterval": "1s",
|
||||
},
|
||||
})),
|
||||
dapr.WithInstanceName(instance.DaprInstanceResourceName),
|
||||
dapr.WithInstanceNamespace(ns.Name),
|
||||
)
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
func testDaprDeploy(test Test, f func(t Test, ns *corev1.Namespace) client.Object) {
|
||||
test.T().Helper()
|
||||
test := With(t)
|
||||
|
||||
ns := test.NewTestNamespace()
|
||||
image := os.Getenv("CATALOG_CONTAINER_IMAGE")
|
||||
|
@ -92,18 +42,33 @@ func testDaprDeploy(test Test, f func(t Test, ns *corev1.Namespace) client.Objec
|
|||
// Dapr
|
||||
//
|
||||
|
||||
res := f(test, ns)
|
||||
_ = dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithDeployment(
|
||||
daprAc.DeploymentSpec().
|
||||
WithNamespace(ns.Name),
|
||||
).
|
||||
WithValues(dapr.Values(test, map[string]interface{}{
|
||||
// enable pod watchdog as sometimes the sidecar for some
|
||||
// (yet) unknown reason is not injected when the pod is
|
||||
// created, hence the dapr app won't properly start up
|
||||
"dapr_operator": map[string]interface{}{
|
||||
"watchInterval": "1s",
|
||||
},
|
||||
})),
|
||||
)
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", res.GetNamespace()), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-operator", ns.Name), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", res.GetNamespace()), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sentry", ns.Name), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", res.GetNamespace()), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", ns.Name), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
|
||||
//
|
||||
// Dapr Application
|
||||
//
|
||||
|
||||
daprTC.ValidateDaprApp(test, res.GetNamespace())
|
||||
daprTC.ValidateDaprApp(test, ns.Name)
|
||||
}
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
package operator
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/conditions"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
"github.com/dapr/kubernetes-operator/test/support/dapr"
|
||||
|
||||
"github.com/rs/xid"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
. "github.com/dapr/kubernetes-operator/test/support"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
daprTC "github.com/dapr/kubernetes-operator/test/e2e/common"
|
||||
)
|
||||
|
||||
func TestDaprControlPlaneDeploy(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
instance := dapr.DeployControlPlane(
|
||||
test,
|
||||
daprAc.DaprControlPlaneSpec().
|
||||
WithValues(dapr.Values(test, map[string]interface{}{
|
||||
// enable pod watchdog as sometimes the sidecar for some
|
||||
// (yet) unknown reason is not injected when the pod is
|
||||
// created, hence the dapr app won't properly start up
|
||||
"dapr_operator": map[string]interface{}{
|
||||
"watchInterval": "1s",
|
||||
},
|
||||
})),
|
||||
)
|
||||
|
||||
test.Eventually(CustomResourceDefinition(test, "components.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "configurations.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "httpendpoints.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "resiliencies.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "subscriptions.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", instance.Namespace), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", instance.Namespace), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
}
|
||||
|
||||
func TestDaprControlPlaneDeployWithApp(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
instance := dapr.DeployControlPlane(
|
||||
test,
|
||||
daprAc.DaprControlPlaneSpec().
|
||||
WithValues(dapr.Values(test, map[string]interface{}{
|
||||
// enable pod watchdog as sometimes the sidecar for some
|
||||
// (yet) unknown reason is not injected when the pod is
|
||||
// created, hence the dapr app won't properly start up
|
||||
"dapr_operator": map[string]interface{}{
|
||||
"watchInterval": "1s",
|
||||
},
|
||||
})),
|
||||
)
|
||||
|
||||
test.Eventually(CustomResourceDefinition(test, "components.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "configurations.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "httpendpoints.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "resiliencies.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "subscriptions.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", instance.Namespace), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", instance.Namespace), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
|
||||
//
|
||||
// Dapr Application
|
||||
//
|
||||
|
||||
daprTC.ValidateDaprApp(test, instance.Namespace)
|
||||
}
|
||||
|
||||
func TestDaprControlPlaneDeployWrongCR(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
instance := dapr.DeployControlPlane(
|
||||
test,
|
||||
daprAc.DaprControlPlaneSpec().
|
||||
WithValues(nil),
|
||||
dapr.WithControlPlaneName(xid.New().String()),
|
||||
dapr.WithControlPlaneNamespace(controller.NamespaceDefault),
|
||||
)
|
||||
|
||||
test.Eventually(dapr.ControlPlane(test, instance), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(conditions.TypeReconciled), Equal(corev1.ConditionFalse)))
|
||||
test.Eventually(dapr.ControlPlane(test, instance), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionReason(conditions.TypeReconciled), Equal(conditions.ReasonUnsupportedConfiguration)))
|
||||
}
|
|
@ -7,28 +7,31 @@ import (
|
|||
|
||||
"github.com/lburgazzoli/gomega-matchers/pkg/matchers/jq"
|
||||
|
||||
"github.com/dapr/kubernetes-operator/pkg/conditions"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
"github.com/dapr/kubernetes-operator/test/support/dapr"
|
||||
|
||||
"github.com/rs/xid"
|
||||
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
. "github.com/dapr/kubernetes-operator/test/support"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1beta1"
|
||||
daprTC "github.com/dapr/kubernetes-operator/test/e2e/common"
|
||||
)
|
||||
|
||||
func TestDaprInstanceDeployWithDefaults(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
ns := controller.NamespaceDefault
|
||||
|
||||
instance := dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithDeployment(
|
||||
daprAc.DeploymentSpec().
|
||||
WithNamespace(ns),
|
||||
).
|
||||
WithValues(nil),
|
||||
)
|
||||
|
||||
|
@ -38,11 +41,11 @@ func TestDaprInstanceDeployWithDefaults(t *testing.T) {
|
|||
test.Eventually(CustomResourceDefinition(test, "resiliencies.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "subscriptions.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-operator", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sentry", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
|
||||
test.Eventually(dapr.Instance(test, instance), TestTimeoutLong).Should(
|
||||
|
@ -57,25 +60,35 @@ func TestDaprInstanceDeployWithDefaults(t *testing.T) {
|
|||
func TestDaprInstanceGC(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
ns := controller.NamespaceDefault
|
||||
|
||||
{
|
||||
instance := dapr.DeployInstance(
|
||||
_ = dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithDeployment(
|
||||
daprAc.DeploymentSpec().
|
||||
WithNamespace(ns),
|
||||
).
|
||||
WithValues(nil),
|
||||
)
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-operator", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sentry", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
}
|
||||
|
||||
{
|
||||
instance := dapr.DeployInstance(
|
||||
_ = dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithDeployment(
|
||||
daprAc.DeploymentSpec().
|
||||
WithNamespace(ns),
|
||||
).
|
||||
WithValues(dapr.Values(test, map[string]any{
|
||||
"dapr_sidecar_injector": map[string]any{
|
||||
"enabled": false,
|
||||
|
@ -83,11 +96,11 @@ func TestDaprInstanceGC(t *testing.T) {
|
|||
})),
|
||||
)
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-operator", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sentry", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", ns), TestTimeoutLong).Should(
|
||||
BeNil())
|
||||
}
|
||||
}
|
||||
|
@ -95,9 +108,15 @@ func TestDaprInstanceGC(t *testing.T) {
|
|||
func TestDaprInstanceDeployWithCustomChart(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
ns := controller.NamespaceDefault
|
||||
|
||||
instance := dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithDeployment(
|
||||
daprAc.DeploymentSpec().
|
||||
WithNamespace(ns),
|
||||
).
|
||||
WithChart(daprAc.ChartSpec().
|
||||
WithVersion("1.14.0")).
|
||||
WithValues(nil),
|
||||
|
@ -109,11 +128,11 @@ func TestDaprInstanceDeployWithCustomChart(t *testing.T) {
|
|||
test.Eventually(CustomResourceDefinition(test, "resiliencies.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "subscriptions.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-operator", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sentry", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
|
||||
test.Eventually(dapr.Instance(test, instance), TestTimeoutLong).Should(
|
||||
|
@ -128,9 +147,15 @@ func TestDaprInstanceDeployWithCustomChart(t *testing.T) {
|
|||
func TestDaprInstanceDeployWithCustomSidecarImage(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
ns := controller.NamespaceDefault
|
||||
|
||||
instance := dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithDeployment(
|
||||
daprAc.DeploymentSpec().
|
||||
WithNamespace(ns),
|
||||
).
|
||||
WithValues(dapr.Values(test, map[string]any{
|
||||
"dapr_sidecar_injector": map[string]any{
|
||||
"image": map[string]any{
|
||||
|
@ -146,11 +171,11 @@ func TestDaprInstanceDeployWithCustomSidecarImage(t *testing.T) {
|
|||
test.Eventually(CustomResourceDefinition(test, "resiliencies.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "subscriptions.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-operator", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sentry", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
|
||||
test.Eventually(dapr.Instance(test, instance), TestTimeoutLong).Should(
|
||||
|
@ -161,7 +186,7 @@ func TestDaprInstanceDeployWithCustomSidecarImage(t *testing.T) {
|
|||
)),
|
||||
)
|
||||
|
||||
test.Eventually(PodList(test, "app=dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(PodList(test, "app=dapr-sidecar-injector", ns), TestTimeoutLong).Should(
|
||||
WithTransform(json.Marshal, And(
|
||||
jq.Match(`.items[0].spec.containers[0].env[] | select(.name == "SIDECAR_IMAGE") | .value == "docker.io/daprio/daprd:%s"`, test.ID()),
|
||||
jq.Match(`.items[0].spec.containers[0].env[] | select(.name == "SIDECAR_IMAGE_PULL_POLICY") | .value == "%s"`, corev1.PullAlways),
|
||||
|
@ -172,9 +197,15 @@ func TestDaprInstanceDeployWithCustomSidecarImage(t *testing.T) {
|
|||
func TestDaprInstanceDeployWithApp(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
ns := controller.NamespaceDefault
|
||||
|
||||
instance := dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithDeployment(
|
||||
daprAc.DeploymentSpec().
|
||||
WithNamespace(ns),
|
||||
).
|
||||
WithValues(dapr.Values(test, map[string]interface{}{
|
||||
// enable pod watchdog as sometimes the sidecar for some
|
||||
// (yet) unknown reason is not injected when the pod is
|
||||
|
@ -191,11 +222,11 @@ func TestDaprInstanceDeployWithApp(t *testing.T) {
|
|||
test.Eventually(CustomResourceDefinition(test, "resiliencies.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
test.Eventually(CustomResourceDefinition(test, "subscriptions.dapr.io"), TestTimeoutLong).Should(Not(BeNil()))
|
||||
|
||||
test.Eventually(Deployment(test, "dapr-operator", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-operator", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sentry", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sentry", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", instance.Namespace), TestTimeoutLong).Should(
|
||||
test.Eventually(Deployment(test, "dapr-sidecar-injector", ns), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(appsv1.DeploymentAvailable), Equal(corev1.ConditionTrue)))
|
||||
|
||||
test.Eventually(dapr.Instance(test, instance), TestTimeoutLong).Should(
|
||||
|
@ -210,22 +241,5 @@ func TestDaprInstanceDeployWithApp(t *testing.T) {
|
|||
// Dapr Application
|
||||
//
|
||||
|
||||
daprTC.ValidateDaprApp(test, instance.Namespace)
|
||||
}
|
||||
|
||||
func TestDaprInstanceDeployWrongCR(t *testing.T) {
|
||||
test := With(t)
|
||||
|
||||
instance := dapr.DeployInstance(
|
||||
test,
|
||||
daprAc.DaprInstanceSpec().
|
||||
WithValues(nil),
|
||||
dapr.WithInstanceName(xid.New().String()),
|
||||
dapr.WithInstanceNamespace(controller.NamespaceDefault),
|
||||
)
|
||||
|
||||
test.Eventually(dapr.Instance(test, instance), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionStatus(conditions.TypeReconciled), Equal(corev1.ConditionFalse)))
|
||||
test.Eventually(dapr.Instance(test, instance), TestTimeoutLong).Should(
|
||||
WithTransform(ConditionReason(conditions.TypeReconciled), Equal(conditions.ReasonUnsupportedConfiguration)))
|
||||
daprTC.ValidateDaprApp(test, ns)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
netv1 "k8s.io/api/networking/v1"
|
||||
netv1ac "k8s.io/client-go/applyconfigurations/networking/v1"
|
||||
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1beta1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/resources"
|
||||
"github.com/dapr/kubernetes-operator/test/support"
|
||||
"github.com/onsi/gomega"
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
package dapr
|
||||
|
||||
import (
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/controlplane"
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
"github.com/dapr/kubernetes-operator/test/support"
|
||||
"github.com/onsi/gomega"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
func ControlPlane(t support.Test, dapr *daprApi.DaprControlPlane) func(g gomega.Gomega) (*daprApi.DaprControlPlane, error) {
|
||||
return func(g gomega.Gomega) (*daprApi.DaprControlPlane, error) {
|
||||
answer, err := t.Client().Dapr().OperatorV1alpha1().DaprControlPlanes(dapr.Namespace).Get(
|
||||
t.Ctx(),
|
||||
dapr.Name,
|
||||
metav1.GetOptions{},
|
||||
)
|
||||
|
||||
if k8serrors.IsNotFound(err) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return answer, err
|
||||
}
|
||||
}
|
||||
|
||||
type ControlPlaneOptions struct {
|
||||
types.NamespacedName
|
||||
}
|
||||
|
||||
type ControlPlaneOption func(*ControlPlaneOptions)
|
||||
|
||||
func WithControlPlaneName(value string) ControlPlaneOption {
|
||||
return func(options *ControlPlaneOptions) {
|
||||
options.Name = value
|
||||
}
|
||||
}
|
||||
|
||||
func WithControlPlaneNamespace(value string) ControlPlaneOption {
|
||||
return func(options *ControlPlaneOptions) {
|
||||
options.Namespace = value
|
||||
}
|
||||
}
|
||||
|
||||
func DeployControlPlane(
|
||||
t support.Test,
|
||||
spec *daprAc.DaprControlPlaneSpecApplyConfiguration,
|
||||
opts ...ControlPlaneOption,
|
||||
) *daprApi.DaprControlPlane {
|
||||
t.T().Helper()
|
||||
|
||||
cpo := ControlPlaneOptions{}
|
||||
cpo.Name = controlplane.DaprControlPlaneResourceName
|
||||
cpo.Namespace = controller.NamespaceDefault
|
||||
|
||||
for _, o := range opts {
|
||||
o(&cpo)
|
||||
}
|
||||
|
||||
t.T().Logf("Setting up DaprControlPlane %s in namespace %s", cpo.Name, cpo.Namespace)
|
||||
|
||||
cp := t.Client().Dapr().OperatorV1alpha1().DaprControlPlanes(cpo.Namespace)
|
||||
|
||||
res, err := cp.Apply(
|
||||
t.Ctx(),
|
||||
daprAc.DaprControlPlane(cpo.Name, cpo.Namespace).
|
||||
WithSpec(spec),
|
||||
metav1.ApplyOptions{
|
||||
FieldManager: "dapr-e2e-" + t.ID(),
|
||||
Force: true,
|
||||
})
|
||||
|
||||
t.Expect(err).
|
||||
ToNot(gomega.HaveOccurred())
|
||||
|
||||
t.Cleanup(func() []runtime.Object {
|
||||
return []runtime.Object{res}
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
|
@ -1,21 +1,19 @@
|
|||
package dapr
|
||||
|
||||
import (
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"github.com/dapr/kubernetes-operator/internal/controller/operator/instance"
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1alpha1"
|
||||
"github.com/dapr/kubernetes-operator/pkg/controller"
|
||||
daprAc "github.com/dapr/kubernetes-operator/pkg/client/applyconfiguration/operator/v1beta1"
|
||||
"github.com/dapr/kubernetes-operator/test/support"
|
||||
"github.com/onsi/gomega"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
func Instance(t support.Test, dapr *daprApi.DaprInstance) func(g gomega.Gomega) (*daprApi.DaprInstance, error) {
|
||||
return func(g gomega.Gomega) (*daprApi.DaprInstance, error) {
|
||||
answer, err := t.Client().Dapr().OperatorV1alpha1().DaprInstances(dapr.Namespace).Get(
|
||||
answer, err := t.Client().Dapr().OperatorV1beta1().DaprInstances().Get(
|
||||
t.Ctx(),
|
||||
dapr.Name,
|
||||
metav1.GetOptions{},
|
||||
|
@ -29,46 +27,17 @@ func Instance(t support.Test, dapr *daprApi.DaprInstance) func(g gomega.Gomega)
|
|||
}
|
||||
}
|
||||
|
||||
type InstanceOptions struct {
|
||||
types.NamespacedName
|
||||
}
|
||||
|
||||
type InstanceOption func(*InstanceOptions)
|
||||
|
||||
func WithInstanceName(value string) InstanceOption {
|
||||
return func(options *InstanceOptions) {
|
||||
options.Name = value
|
||||
}
|
||||
}
|
||||
|
||||
func WithInstanceNamespace(value string) InstanceOption {
|
||||
return func(options *InstanceOptions) {
|
||||
options.Namespace = value
|
||||
}
|
||||
}
|
||||
|
||||
func DeployInstance(
|
||||
t support.Test,
|
||||
spec *daprAc.DaprInstanceSpecApplyConfiguration,
|
||||
opts ...InstanceOption,
|
||||
) *daprApi.DaprInstance {
|
||||
t.T().Helper()
|
||||
|
||||
io := InstanceOptions{}
|
||||
io.Name = instance.DaprInstanceResourceName
|
||||
io.Namespace = controller.NamespaceDefault
|
||||
|
||||
for _, o := range opts {
|
||||
o(&io)
|
||||
}
|
||||
|
||||
t.T().Logf("Setting up DaprInstance %s in namespace %s", io.Name, io.Namespace)
|
||||
|
||||
cp := t.Client().Dapr().OperatorV1alpha1().DaprInstances(io.Namespace)
|
||||
cp := t.Client().Dapr().OperatorV1beta1().DaprInstances()
|
||||
|
||||
res, err := cp.Apply(
|
||||
t.Ctx(),
|
||||
daprAc.DaprInstance(io.Name, io.Namespace).
|
||||
daprAc.DaprInstance(instance.DaprInstanceResourceName).
|
||||
WithSpec(spec),
|
||||
metav1.ApplyOptions{
|
||||
FieldManager: "dapr-e2e-" + t.ID(),
|
||||
|
@ -78,7 +47,7 @@ func DeployInstance(
|
|||
t.Expect(err).
|
||||
ToNot(gomega.HaveOccurred())
|
||||
|
||||
t.T().Logf("DaprInstance %s in namespace %s created", io.Name, io.Namespace)
|
||||
t.T().Logf("DaprInstance %s in namespace %s created", res.Name, res.Spec.Deployment.Namespace)
|
||||
|
||||
t.Cleanup(func() []runtime.Object {
|
||||
return []runtime.Object{res}
|
||||
|
|
|
@ -125,7 +125,7 @@ func DeployOperator(test support.Test, ns *corev1.Namespace, image string) {
|
|||
Namespace: ns.Name,
|
||||
},
|
||||
Spec: &olmV1Alpha1.SubscriptionSpec{
|
||||
Channel: "alpha",
|
||||
Channel: "beta",
|
||||
Package: "dapr-kubernetes-operator",
|
||||
InstallPlanApproval: olmV1Alpha1.ApprovalAutomatic,
|
||||
CatalogSource: catalog.Name,
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
helmsupport "github.com/dapr/kubernetes-operator/test/support/helm"
|
||||
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1alpha1"
|
||||
daprApi "github.com/dapr/kubernetes-operator/api/operator/v1beta1"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
|
||||
"github.com/go-logr/logr/testr"
|
||||
|
|
Loading…
Reference in New Issue