This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
-
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.
Merge pull request #378 from slagle/openstackdataplanedeployment
Add OpenStackDataPlaneDeployment CRD
- Loading branch information
Showing
42 changed files
with
1,142 additions
and
285 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
91 changes: 91 additions & 0 deletions
91
api/bases/dataplane.openstack.org_openstackdataplanedeployments.yaml
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,91 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.11.1 | ||
creationTimestamp: null | ||
name: openstackdataplanedeployments.dataplane.openstack.org | ||
spec: | ||
group: dataplane.openstack.org | ||
names: | ||
kind: OpenStackDataPlaneDeployment | ||
listKind: OpenStackDataPlaneDeploymentList | ||
plural: openstackdataplanedeployments | ||
shortNames: | ||
- osdpd | ||
- osdpdeployment | ||
- osdpdeployments | ||
singular: openstackdataplanedeployment | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- description: NodeSets | ||
jsonPath: .spec.NodeSets | ||
name: NodeSets | ||
type: string | ||
- description: Status | ||
jsonPath: .status.conditions[0].status | ||
name: Status | ||
type: string | ||
- description: Message | ||
jsonPath: .status.conditions[0].message | ||
name: Message | ||
type: string | ||
name: v1beta1 | ||
schema: | ||
openAPIV3Schema: | ||
properties: | ||
apiVersion: | ||
type: string | ||
kind: | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
properties: | ||
ansibleLimit: | ||
type: string | ||
ansibleSkipTags: | ||
type: string | ||
ansibleTags: | ||
type: string | ||
nodeSets: | ||
items: | ||
type: string | ||
type: array | ||
required: | ||
- nodeSets | ||
type: object | ||
status: | ||
properties: | ||
conditions: | ||
items: | ||
properties: | ||
lastTransitionTime: | ||
format: date-time | ||
type: string | ||
message: | ||
type: string | ||
reason: | ||
type: string | ||
severity: | ||
type: string | ||
status: | ||
type: string | ||
type: | ||
type: string | ||
required: | ||
- lastTransitionTime | ||
- status | ||
- type | ||
type: object | ||
type: array | ||
deployed: | ||
type: boolean | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
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
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,110 @@ | ||
/* | ||
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 v1beta1 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/openstack-k8s-operators/lib-common/modules/common/condition" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// OpenStackDataPlaneDeploymentSpec defines the desired state of OpenStackDataPlaneDeployment | ||
type OpenStackDataPlaneDeploymentSpec struct { | ||
|
||
// +kubebuilder:validation:Required | ||
// NodeSets is the list of NodeSets deployed | ||
NodeSets []string `json:"nodeSets"` | ||
|
||
// AnsibleTags for ansible execution | ||
// +kubebuilder:validation:Optional | ||
AnsibleTags string `json:"ansibleTags,omitempty"` | ||
|
||
// AnsibleLimit for ansible execution | ||
// +kubebuilder:validation:Optional | ||
AnsibleLimit string `json:"ansibleLimit,omitempty"` | ||
|
||
// AnsibleSkipTags for ansible execution | ||
// +kubebuilder:validation:Optional | ||
AnsibleSkipTags string `json:"ansibleSkipTags,omitempty"` | ||
} | ||
|
||
// OpenStackDataPlaneDeploymentStatus defines the observed state of OpenStackDataPlaneDeployment | ||
type OpenStackDataPlaneDeploymentStatus struct { | ||
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:io.kubernetes.conditions"} | ||
// Conditions | ||
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"` | ||
|
||
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} | ||
// Deployed | ||
Deployed bool `json:"deployed,omitempty" optional:"true"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
//+operator-sdk:csv:customresourcedefinitions:displayName="OpenStack Data Plane Deployments" | ||
//+kubebuilder:resource:shortName=osdpd;osdpdeployment;osdpdeployments | ||
//+kubebuilder:printcolumn:name="NodeSets",type="string",JSONPath=".spec.NodeSets",description="NodeSets" | ||
//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[0].status",description="Status" | ||
//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[0].message",description="Message" | ||
|
||
// OpenStackDataPlaneDeployment is the Schema for the openstackdataplanedeployments API | ||
type OpenStackDataPlaneDeployment struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec OpenStackDataPlaneDeploymentSpec `json:"spec,omitempty"` | ||
Status OpenStackDataPlaneDeploymentStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// OpenStackDataPlaneDeploymentList contains a list of OpenStackDataPlaneDeployment | ||
type OpenStackDataPlaneDeploymentList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []OpenStackDataPlaneDeployment `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&OpenStackDataPlaneDeployment{}, &OpenStackDataPlaneDeploymentList{}) | ||
} | ||
|
||
// IsReady - returns true if the OpenStackDataPlaneDeployment is ready | ||
func (instance OpenStackDataPlaneDeployment) IsReady() bool { | ||
return instance.Status.Conditions.IsTrue(condition.ReadyCondition) | ||
} | ||
|
||
// InitConditions - Initializes Status Conditons | ||
func (instance *OpenStackDataPlaneDeployment) InitConditions() { | ||
instance.Status.Conditions = condition.Conditions{} | ||
|
||
cl := condition.CreateList( | ||
condition.UnknownCondition(condition.DeploymentReadyCondition, condition.InitReason, condition.InitReason), | ||
condition.UnknownCondition(condition.InputReadyCondition, condition.InitReason, condition.InitReason), | ||
) | ||
|
||
if instance.Spec.NodeSets != nil { | ||
for _, nodeSet := range instance.Spec.NodeSets { | ||
readyCondition := condition.Type(fmt.Sprintf(NodeSetDeploymentReadyCondition, nodeSet)) | ||
cl = append(cl, *condition.UnknownCondition(readyCondition, condition.InitReason, condition.InitReason)) | ||
} | ||
} | ||
|
||
instance.Status.Conditions.Init(&cl) | ||
instance.Status.Deployed = false | ||
} |
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
Oops, something went wrong.