-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: Update SSP API version to v1beta3
The new API version removes feature gates and unused parameters. It is directly compatible with the old version, so a conversion webhook is not needed. The stored version is still set to v1beta2, and ssp-operator watches this old version. In a next release we may switch to using the v1beta3 as stored version. Signed-off-by: Andrej Krejcir <[email protected]>
- Loading branch information
Showing
21 changed files
with
5,716 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
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 v1beta3 contains API Schema definitions for the ssp v1beta3 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=ssp.kubevirt.io | ||
package v1beta3 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "ssp.kubevirt.io", Version: "v1beta3"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* | ||
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 v1beta3 | ||
|
||
import ( | ||
ocpv1 "github.com/openshift/api/config/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
cdiv1beta1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" | ||
lifecycleapi "kubevirt.io/controller-lifecycle-operator-sdk/api" | ||
) | ||
|
||
const ( | ||
OperatorPausedAnnotation = "kubevirt.io/operator.paused" | ||
) | ||
|
||
type TemplateValidator struct { | ||
// Replicas is the number of replicas of the template validator pod | ||
//+kubebuilder:validation:Minimum=0 | ||
//+kubebuilder:default=2 | ||
Replicas *int32 `json:"replicas,omitempty"` | ||
|
||
// Placement describes the node scheduling configuration | ||
Placement *lifecycleapi.NodePlacement `json:"placement,omitempty"` | ||
} | ||
|
||
type CommonTemplates struct { | ||
// Namespace is the k8s namespace where CommonTemplates should be installed | ||
//+kubebuilder:validation:MaxLength=63 | ||
//+kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ | ||
Namespace string `json:"namespace"` | ||
|
||
// DataImportCronTemplates defines a list of DataImportCrons managed by the SSP Operator. | ||
DataImportCronTemplates []DataImportCronTemplate `json:"dataImportCronTemplates,omitempty"` | ||
} | ||
|
||
// SSPSpec defines the desired state of SSP | ||
type SSPSpec struct { | ||
// TemplateValidator is configuration of the template validator operand | ||
TemplateValidator *TemplateValidator `json:"templateValidator,omitempty"` | ||
|
||
// CommonTemplates is the configuration of the common templates operand | ||
CommonTemplates CommonTemplates `json:"commonTemplates"` | ||
|
||
// TLSSecurityProfile is a configuration for the TLS. | ||
TLSSecurityProfile *ocpv1.TLSSecurityProfile `json:"tlsSecurityProfile,omitempty"` | ||
|
||
// TokenGenerationService configures the service for generating tokens to access VNC for a VM. | ||
TokenGenerationService *TokenGenerationService `json:"tokenGenerationService,omitempty"` | ||
} | ||
|
||
// DataImportCronTemplate defines the template type for DataImportCrons. | ||
// It requires metadata.name to be specified while leaving namespace as optional. | ||
type DataImportCronTemplate struct { | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec cdiv1beta1.DataImportCronSpec `json:"spec"` | ||
} | ||
|
||
// AsDataImportCron converts the DataImportCronTemplate to a cdiv1beta1.DataImportCron | ||
func (t *DataImportCronTemplate) AsDataImportCron() cdiv1beta1.DataImportCron { | ||
return cdiv1beta1.DataImportCron{ | ||
ObjectMeta: t.ObjectMeta, | ||
Spec: t.Spec, | ||
} | ||
} | ||
|
||
// TokenGenerationService configures the service for generating tokens to access VNC for a VM. | ||
type TokenGenerationService struct { | ||
Enabled bool `json:"enabled,omitempty"` | ||
} | ||
|
||
// SSPStatus defines the observed state of SSP | ||
type SSPStatus struct { | ||
lifecycleapi.Status `json:",inline"` | ||
|
||
// Paused is true when the operator notices paused annotation. | ||
Paused bool `json:"paused,omitempty"` | ||
|
||
// ObservedGeneration is the latest generation observed by the operator. | ||
ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase" | ||
|
||
// SSP is the Schema for the ssps API | ||
type SSP struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec SSPSpec `json:"spec,omitempty"` | ||
Status SSPStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// SSPList contains a list of SSP | ||
type SSPList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []SSP `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&SSP{}, &SSPList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.