Skip to content

Commit

Permalink
moved to more generic names for ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
eshulman2 committed Jun 30, 2024
1 parent 78170ac commit ba8a74a
Show file tree
Hide file tree
Showing 19 changed files with 427 additions and 354 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.1
creationTimestamp: null
name: trexperformances.test.openstack.org
name: ansibletests.test.openstack.org
spec:
group: test.openstack.org
names:
kind: TrexPerformance
listKind: TrexPerformanceList
plural: trexperformances
singular: trexperformance
kind: AnsibleTests
listKind: AnsibleTestsList
plural: ansibletests
singular: ansibletests
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: TrexPerformanceStatus is the Schema for the TrexPerformanceStatus
API
description: AnsibleTestsStatus is the Schema for the AnsibleTestsStatus API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -34,7 +33,7 @@ spec:
metadata:
type: object
spec:
description: TrexPerformanceSpec defines the desired state of TrexPerformance
description: AnsibleTestsSpec defines the desired state of AnsibleTests
properties:
ansibleCollections:
default: ""
Expand Down Expand Up @@ -74,11 +73,11 @@ spec:
default: dataplane-ansible-ssh-private-key-secret
description: ComputeSSHKeySecretName is the name of the k8s secret
that contains an ssh key for computes. The key is mounted to ~/.ssh/id_ecdsa
in the perf pod
in the ansible pod
type: string
containerImage:
default: quay.io/podified-antelope-centos9/openstack-trex-perf:current-podified
description: Container image for TrexPerformance
default: quay.io/podified-antelope-centos9/openstack-ansible-tests:current-podified
description: Container image for AnsibleTests
type: string
debug:
default: false
Expand Down Expand Up @@ -145,11 +144,11 @@ spec:
default: dataplane-ansible-ssh-private-key-secret
description: ComputeSSHKeySecretName is the name of the k8s
secret that contains an ssh key for computes. The key is mounted
to ~/.ssh/id_ecdsa in the perf pod
to ~/.ssh/id_ecdsa in the ansible pod
type: string
containerImage:
default: quay.io/podified-antelope-centos9/openstack-trex-performance:current-podified
description: Container image for TrexPerformance
default: quay.io/podified-antelope-centos9/openstack-ansible-testsormance:current-podified
description: Container image for AnsibleTests
type: string
debug:
default: false
Expand Down Expand Up @@ -177,8 +176,8 @@ spec:
workloadSSHKeySecretName:
default: ""
description: WorkloadSSHKeySecretName is the name of the k8s
secret that contains an ssh key for the performance workload.
The key is mounted to ~/test_keypair.key in the perf pod
secret that contains an ssh key for the ansible workload.
The key is mounted to ~/test_keypair.key in the ansible pod
type: string
required:
- computeSSHKeySecretName
Expand All @@ -192,8 +191,8 @@ spec:
workloadSSHKeySecretName:
default: ""
description: WorkloadSSHKeySecretName is the name of the k8s secret
that contains an ssh key for the performance workload. The key is
mounted to ~/test_keypair.key in the perf pod
that contains an ssh key for the ansible workload. The key is mounted
to ~/test_keypair.key in the ansible pod
type: string
required:
- computeSSHKeySecretName
Expand All @@ -204,7 +203,7 @@ spec:
- workloadSSHKeySecretName
type: object
status:
description: TrexPerformanceStatus defines the observed state of TrexPerformance
description: AnsibleTestsStatus defines the observed state of AnsibleTests
properties:
conditions:
description: Conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,184 +24,204 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// TrexPerformanceSpec defines the desired state of TrexPerformance
type TrexPerformanceSpec struct {
// AnsibleTestsSpec defines the desired state of AnsibleTests
type AnsibleTestsSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// Name of a workflow step. The step name will be used for example to create
// a logs directory.
StepName string `json:"stepName"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default="local-storage"
// StorageClass used to create PVCs that store the logs
StorageClass string `json:"storageClass"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default="dataplane-ansible-ssh-private-key-secret"
// ComputeSSHKeySecretName is the name of the k8s secret that contains an ssh key for computes.
// The key is mounted to ~/.ssh/id_ecdsa in the perf pod
// The key is mounted to ~/.ssh/id_ecdsa in the ansible pod
ComputesSSHKeySecretName string `json:"computeSSHKeySecretName"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=""
// WorkloadSSHKeySecretName is the name of the k8s secret that contains an ssh key for the performance workload.
// The key is mounted to ~/test_keypair.key in the perf pod
// WorkloadSSHKeySecretName is the name of the k8s secret that contains an ssh key for the ansible workload.
// The key is mounted to ~/test_keypair.key in the ansible pod
WorkloadSSHKeySecretName string `json:"workloadSSHKeySecretName"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=""
// AnsibleGitRepo - git repo to clone into container
AnsibleGitRepo string `json:"ansibleGitRepo,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=""
// AnsiblePlaybookPath - path to ansible playbook
AnsiblePlaybookPath string `json:"ansiblePlaybookPath,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
// +kubebuilder:default=""
// AnsibleCollections - extra ansible collections to instal in additionn to the ones exist in the requirements.yaml
AnsibleCollections string `json:"ansibleCollections,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
// +kubebuilder:default=""
// AnsibleVarFiles - interface to create ansible var files Those get added to the
AnsibleVarFiles string `json:"ansibleVarFiles,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
// +kubebuilder:default=""
// AnsibleExtraVars - string to pass parameters to ansible using
AnsibleExtraVars string `json:"ansibleExtraVars,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
// +kubebuilder:default=""
// AnsibleInventory - string that contains the inventory file content
AnsibleInventory string `json:"ansibleInventory,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=openstack-config
// OpenStackConfigMap is the name of the ConfigMap containing the clouds.yaml
OpenStackConfigMap string `json:"openStackConfigMap"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=openstack-config-secret
// OpenStackConfigSecret is the name of the Secret containing the secure.yaml
OpenStackConfigSecret string `json:"openStackConfigSecret"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Optional
// +kubebuilder:default:=false
// Run ansible playbook with -vvvv
Debug bool `json:"debug,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Optional
// +kubebuilder:default:="quay.io/podified-antelope-centos9/openstack-trex-perf:current-podified"
// Container image for TrexPerformance
// +kubebuilder:default:="quay.io/podified-antelope-centos9/openstack-ansible-tests:current-podified"
// Container image for AnsibleTests
ContainerImage string `json:"containerImage,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// BackoffLimimt allows to define the maximum number of retried executions (defaults to 6).
// +kubebuilder:default:=0
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:number"}
BackoffLimit *int32 `json:"backoffLimit,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// A parameter that contains a workflow definition.
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:number"}
Workflow []TrexPerformanceWorkflowSpec `json:"workflow,omitempty"`
Workflow []AnsibleTestsWorkflowSpec `json:"workflow,omitempty"`
}

type TrexPerformanceWorkflowSpec struct {
type AnsibleTestsWorkflowSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// Name of a workflow step. The step name will be used for example to create
// a logs directory.
StepName string `json:"stepName"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default="local-storage"
// StorageClass used to create PVCs that store the logs
StorageClass *string `json:"storageClass"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default="dataplane-ansible-ssh-private-key-secret"
// ComputeSSHKeySecretName is the name of the k8s secret that contains an ssh key for computes.
// The key is mounted to ~/.ssh/id_ecdsa in the perf pod
// The key is mounted to ~/.ssh/id_ecdsa in the ansible pod
ComputesSSHKeySecretName *string `json:"computeSSHKeySecretName"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=""
// WorkloadSSHKeySecretName is the name of the k8s secret that contains an ssh key for the performance workload.
// The key is mounted to ~/test_keypair.key in the perf pod
// WorkloadSSHKeySecretName is the name of the k8s secret that contains an ssh key for the ansible workload.
// The key is mounted to ~/test_keypair.key in the ansible pod
WorkloadSSHKeySecretName *string `json:"workloadSSHKeySecretName"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=""
// AnsibleGitRepo - git repo to clone into container
AnsibleGitRepo string `json:"ansibleGitRepo,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=""
// AnsiblePlaybookPath - path to ansible playbook
AnsiblePlaybookPath string `json:"ansiblePlaybookPath,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
// +kubebuilder:default=""
// AnsibleCollections - extra ansible collections to instal in additionn to the ones exist in the requirements.yaml
AnsibleCollections string `json:"ansibleCollections,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
// +kubebuilder:default=""
// AnsibleVarFiles - interface to create ansible var files Those get added to the
// service config dir in /etc/test_operator/<file> and passed to the ansible command using -e @/etc/test_operator/<file>
AnsibleVarFiles *string `json:"ansibleVarFiles,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
// +kubebuilder:default=""
// AnsibleExtraVars - interface to pass parameters to ansible using -e
AnsibleExtraVars *string `json:"ansibleExtraVars,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:optional
// +kubebuilder:default=""
// AnsibleInventory - string that contains the inventory file content
AnsibleInventory string `json:"ansibleInventory,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=openstack-config
// OpenStackConfigMap is the name of the ConfigMap containing the clouds.yaml
OpenStackConfigMap *string `json:"openStackConfigMap"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Required
// +kubebuilder:default=openstack-config-secret
// OpenStackConfigSecret is the name of the Secret containing the secure.yaml
OpenStackConfigSecret *string `json:"openStackConfigSecret"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Optional
// +kubebuilder:default:=false
// Run ansible playbook with -vvvv
Debug *bool `json:"debug,omitempty"`

// // +kubebuilder:validation:Optional
// // AnsibleRepo contains information about ansible repo that should be installed
// // within the test pod.
// AnsibleRepo *[]ExternalPluginType `json:"AnsibleRepo,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Optional
// +kubebuilder:default:="quay.io/podified-antelope-centos9/openstack-trex-performance:current-podified"
// Container image for TrexPerformance
// +kubebuilder:default:="quay.io/podified-antelope-centos9/openstack-ansible-testsormance:current-podified"
// Container image for AnsibleTests
ContainerImage *string `json:"containerImage,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=spec
// BackoffLimimt allows to define the maximum number of retried executions (defaults to 6).
// +kubebuilder:default:=0
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:number"}
BackoffLimit *int32 `json:"backoffLimit,omitempty"`

// Name of a secret that contains a kubeconfig. The kubeconfig is mounted under /var/lib/TrexPerformance/.kube/config
// in the test pod.
// +kubebuilder:default:=""
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:number"}
// KubeconfigSecretName *string `json:"kubeconfigSecretName,omitempty"`
}

// TrexPerformanceStatus defines the observed state of TrexPerformance
type TrexPerformanceStatus struct {
// AnsibleTestsStatus defines the observed state of AnsibleTests
type AnsibleTestsStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

Expand All @@ -218,39 +238,39 @@ type TrexPerformanceStatus struct {
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// TrexPerformanceStatus is the Schema for the TrexPerformanceStatus API
type TrexPerformance struct {
// AnsibleTestsStatus is the Schema for the AnsibleTestsStatus API
type AnsibleTests struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec TrexPerformanceSpec `json:"spec,omitempty"`
Status TrexPerformanceStatus `json:"status,omitempty"`
Spec AnsibleTestsSpec `json:"spec,omitempty"`
Status AnsibleTestsStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// TrexPerformanceList contains a list of TrexPerformance
type TrexPerformanceList struct {
// AnsibleTestsList contains a list of AnsibleTests
type AnsibleTestsList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []TrexPerformance `json:"items"`
Items []AnsibleTests `json:"items"`
}

func init() {
SchemeBuilder.Register(&TrexPerformance{}, &TrexPerformanceList{})
SchemeBuilder.Register(&AnsibleTests{}, &AnsibleTestsList{})
}

// RbacConditionsSet - set the conditions for the rbac object
func (instance TrexPerformance) RbacConditionsSet(c *condition.Condition) {
func (instance AnsibleTests) RbacConditionsSet(c *condition.Condition) {
instance.Status.Conditions.Set(c)
}

// RbacNamespace - return the namespace
func (instance TrexPerformance) RbacNamespace() string {
func (instance AnsibleTests) RbacNamespace() string {
return instance.Namespace
}

// RbacResourceName - return the name to be used for rbac objects (serviceaccount, role, rolebinding)
func (instance TrexPerformance) RbacResourceName() string {
func (instance AnsibleTests) RbacResourceName() string {
return instance.Name
}
Loading

0 comments on commit ba8a74a

Please sign in to comment.