Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 6 additions & 38 deletions operator/v1/types.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package v1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
)

// MyOperatorResource is an example operator configuration type
Expand Down Expand Up @@ -59,10 +58,6 @@ type OperatorSpec struct {
// +optional
OperatorLogLevel LogLevel `json:"operatorLogLevel"`

// operandSpecs provide customization for functional units within the component
// +optional
OperandSpecs []OperandSpec `json:"operandSpecs,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we simply do not want support for applying a patch on the operand's deployment/pod?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we simply do not want support for applying a patch on the operand's deployment/pod?

We don't today. We'll see what we need later


// unsupportedConfigOverrides holds a sparse config that will override any previously set options. It only needs to be the fields to override
// it will end up overlaying in the following order:
// 1. hardcoded defaults
Expand Down Expand Up @@ -96,38 +91,6 @@ var (
TraceAll LogLevel = "TraceAll"
)

// ResourcePatch is a way to represent the patch you would issue to `kubectl patch` in the API
type ResourcePatch struct {
// type is the type of patch to apply: jsonmerge, strategicmerge
Type string `json:"type"`
// patch the patch itself
Patch string `json:"patch"`
}

// OperandSpec holds information for customization of a particular functional unit - logically maps to a workload
type OperandSpec struct {
// name is the name of this unit. The operator must be aware of it.
Name string `json:"name"`

// operandContainerSpecs are per-container options
// +optional
OperandContainerSpecs []OperandContainerSpec `json:"operandContainerSpecs,omitempty"`

// unsupportedResourcePatches are applied to the workload resource for this unit. This is an unsupported
// workaround if anything needs to be modified on the workload that is not otherwise configurable.
// TODO Decide: alternatively, we could simply include a RawExtension which is used in place of the "normal" default manifest
// +optional
UnsupportedResourcePatches []ResourcePatch `json:"unsupportedResourcePatches,omitempty"`
}

type OperandContainerSpec struct {
// name is the name of the container to modify
Name string `json:"name"`

// resources are the requests and limits to place in the container. Nil means to accept the defaults.
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
}

type OperatorStatus struct {
// observedGeneration is the last generation change you've dealt with
// +optional
Expand Down Expand Up @@ -200,6 +163,11 @@ const (
type StaticPodOperatorSpec struct {
OperatorSpec `json:",inline"`

// forceRedeploymentReason can be used to force the redeployment of the operand by providing a unique string.
// This provides a mechanism to kick a previously failed deployment and provide a reason why you think it will work
// this time instead of failing again on the same config.
ForceRedeploymentReason string `json:"forceRedeploymentReason"`

// failedRevisionLimit is the number of failed static pod installer revisions to keep on disk and in the api
// -1 = unlimited, 0 or unset = 5 (default)
FailedRevisionLimit int32 `json:"failedRevisionLimit,omitempty"`
Expand Down
7 changes: 1 addition & 6 deletions operator/v1/types_kubeapiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ type KubeAPIServer struct {
metav1.ObjectMeta `json:"metadata"`

// +required
Spec KubeAPIServerSpec `json:"spec"`
Spec KubeAPIServerSpec `json:"spec"`
// +optional
Status KubeAPIServerStatus `json:"status"`
}

type KubeAPIServerSpec struct {
StaticPodOperatorSpec `json:",inline"`

// forceRedeploymentReason can be used to force the redeployment of the kube-apiserver by providing a unique string.
// This provides a mechanism to kick a previously failed deployment and provide a reason why you think it will work
// this time instead of failing again on the same config.
ForceRedeploymentReason string `json:"forceRedeploymentReason"`
}

type KubeAPIServerStatus struct {
Expand Down
7 changes: 1 addition & 6 deletions operator/v1/types_kubecontrollermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ type KubeControllerManager struct {
metav1.ObjectMeta `json:"metadata"`

// +required
Spec KubeControllerManagerSpec `json:"spec"`
Spec KubeControllerManagerSpec `json:"spec"`
// +optional
Status KubeControllerManagerStatus `json:"status"`
}

type KubeControllerManagerSpec struct {
StaticPodOperatorSpec `json:",inline"`

// forceRedeploymentReason can be used to force the redeployment of the kube-controller-manager by providing a unique string.
// This provides a mechanism to kick a previously failed deployment and provide a reason why you think it will work
// this time instead of failing again on the same config.
ForceRedeploymentReason string `json:"forceRedeploymentReason"`
}

type KubeControllerManagerStatus struct {
Expand Down
7 changes: 1 addition & 6 deletions operator/v1/types_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ type KubeScheduler struct {
metav1.ObjectMeta `json:"metadata"`

// +required
Spec KubeSchedulerSpec `json:"spec"`
Spec KubeSchedulerSpec `json:"spec"`
// +optional
Status KubeSchedulerStatus `json:"status"`
}

type KubeSchedulerSpec struct {
StaticPodOperatorSpec `json:",inline"`

// forceRedeploymentReason can be used to force the redeployment of the kube-scheduler by providing a unique string.
// This provides a mechanism to kick a previously failed deployment and provide a reason why you think it will work
// this time instead of failing again on the same config.
ForceRedeploymentReason string `json:"forceRedeploymentReason"`
}

type KubeSchedulerStatus struct {
Expand Down
72 changes: 0 additions & 72 deletions operator/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 3 additions & 57 deletions operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.