Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#242 from openstack-k8s-ope…
Browse files Browse the repository at this point in the history
…rators/renovate/openstack-k8s-operators

Update openstack-k8s-operators to 6e3a5f3
  • Loading branch information
openshift-ci[bot] authored and rebtoor committed Oct 23, 2023
2 parents 436c8bf + 349b99b commit a363c37
Show file tree
Hide file tree
Showing 24 changed files with 4,017 additions and 37 deletions.
8 changes: 8 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ resources:
defaulting: true
validation: true
webhookVersion: v1
- api:
crdVersion: v1
namespaced: true
domain: openstack.org
group: ansibleee
kind: OpenStackAnsibleEE
path: github.com/openstack-k8s-operators/openstack-ansibleee-operator/api/v1beta1
version: v1beta1
version: "3"
1,557 changes: 1,557 additions & 0 deletions api/bases/ansibleee.openstack.org_openstackansibleees.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.19
require (
github.com/onsi/ginkgo/v2 v2.13.0
github.com/onsi/gomega v1.28.0
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20231011150636-e8a0540a3c32
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20231011150636-e8a0540a3c32
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20231018065241-6e3a5f39ef22
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20231018065241-6e3a5f39ef22
k8s.io/api v0.26.9
k8s.io/apimachinery v0.26.9
k8s.io/client-go v0.26.9
Expand Down
8 changes: 4 additions & 4 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4
github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8=
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20231011150636-e8a0540a3c32 h1:r24jE5tdacLivcZczb3t6RvbvHp6kXQrW2ECuekzgH8=
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20231011150636-e8a0540a3c32/go.mod h1:xXAuy7HtWN4p7LF5Q+NHLkwAsKVh0KrzpnuPYIG3XaA=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20231011150636-e8a0540a3c32 h1:UswqYNyvW/ne9oI9rLwddyT7F/MT+ggL9ElMtO2SRRY=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20231011150636-e8a0540a3c32/go.mod h1:baotYmNGQjRCgu/9LxjrFZzTIT2/4yLktJK8h/Fa0Ig=
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20231018065241-6e3a5f39ef22 h1:jb8KSWZa7Bb8uComg/MXUoD1fWfjVJJiMjNcMEvQSoM=
github.com/openstack-k8s-operators/lib-common/modules/common v0.3.1-0.20231018065241-6e3a5f39ef22/go.mod h1:xXAuy7HtWN4p7LF5Q+NHLkwAsKVh0KrzpnuPYIG3XaA=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20231018065241-6e3a5f39ef22 h1:38mhfoFrflAfhZZWXBsc4Va7xEQL/pZ5qrqdt8gCbhU=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.3.1-0.20231018065241-6e3a5f39ef22/go.mod h1:baotYmNGQjRCgu/9LxjrFZzTIT2/4yLktJK8h/Fa0Ig=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
47 changes: 47 additions & 0 deletions api/v1beta1/conditions.go
Original file line number Diff line number Diff line change
@@ -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.
*/

package v1beta1

import condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"

// AnsibleEE Condition Types.
const (
// AnsibleExecutionJobReadyCondition Status=True condition indicates
// AnsibleExecutionJob is ready.
AnsibleExecutionJobReadyCondition condition.Type = "AnsibleExecutionJobReady"
)

// Common Messages used by AnsibleEE objects.
const (
//
// AnsibleExecutionJob condition messages
//
// AnsibleExecutionJobInitMessage
AnsibleExecutionJobInitMessage = "AnsibleExecutionJob not started"

// AnsibleExecutionJobReadyMessage
AnsibleExecutionJobReadyMessage = "AnsibleExecutionJob complete"

// AnsibleExecutionJobNotFoundMessage
AnsibleExecutionJobNotFoundMessage = "AnsibleExecutionJob not found"

// AnsibleExecutionJobWaitingMessage
AnsibleExecutionJobWaitingMessage = "AnsibleExecutionJob is running"

// AnsibleExecutionJobErrorMessage
AnsibleExecutionJobErrorMessage = "AnsibleExecutionJob error occured %s"
)
36 changes: 36 additions & 0 deletions api/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright 2022.
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 contains API Schema definitions for the v1beta1 API group
// +kubebuilder:object:generate=true
// +groupName=ansibleee.openstack.org
package v1beta1

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: "ansibleee.openstack.org", Version: "v1beta1"}

// 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
)
189 changes: 189 additions & 0 deletions api/v1beta1/openstack_ansibleee_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
/*
Copyright 2022.
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 (
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
"github.com/openstack-k8s-operators/lib-common/modules/storage"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
// Container image fall-back defaults

// OpenStackAnsibleEEContainerImage is the fall-back container image for OpenStackAnsibleEE
OpenStackAnsibleEEContainerImage = "quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest"
)

const (
// JobStatusSucceeded -
JobStatusSucceeded = "Succeeded"

// JobStatusFailed -
JobStatusFailed = "Failed"

// JobStatusRunning -
JobStatusRunning = "Running"

// JobStatusPending -
JobStatusPending = "Pending"
)

// OpenStackAnsibleEESpec defines the desired state of OpenStackAnsibleEE
//+kubebuilder:storageversion
type OpenStackAnsibleEESpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Play is an inline playbook contents that ansible will run on execution.
// If both Play and Roles are specified, Play takes precedence
Play string `json:"play,omitempty"`
// Playbook is the playbook that ansible will run on this execution, accepts path or FQN from collection
Playbook string `json:"playbook,omitempty"`
// Image is the container image that will execute the ansible command
Image string `json:"image,omitempty"`
// Args are the command plus the playbook executed by the image. If args is passed, Playbook is ignored.
Args []string `json:"args,omitempty"`
// Name is the name of the internal container inside the pod
// +kubebuilder:default:="openstackansibleee"
Name string `json:"name,omitempty"`
// EnvConfigMapName is the name of the k8s config map that contains the ansible env variables
// +kubebuilder:default:="openstack-aee-default-env"
EnvConfigMapName string `json:"envConfigMapName,omitempty"`
// Env is a list containing the environment variables to pass to the pod
Env []corev1.EnvVar `json:"env,omitempty"`
// RestartPolicy is the policy applied to the Job on whether it needs to restart the Pod. It can be "OnFailure" or "Never".
// RestartPolicy default: Never
// +kubebuilder:validation:Enum:=OnFailure;Never
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:select:OnFailure","urn:alm:descriptor:com.tectonic.ui:select:Never"}
// +kubebuilder:default:="Never"
RestartPolicy string `json:"restartPolicy,omitempty"`
// PreserveJobs - do not delete jobs after they finished e.g. to check logs
// PreserveJobs default: true
// +kubebuilder:validation:Enum:=true;false
// +kubebuilder:default:=true
PreserveJobs bool `json:"preserveJobs,omitempty"`
// UID is the userid that will be used to run the container.
// +kubebuilder:default:=1001
UID int64 `json:"uid,omitempty"`
// Inventory is the inventory that the ansible playbook will use to launch the job.
Inventory string `json:"inventory,omitempty"`
// +kubebuilder:validation:Optional
// ExtraMounts containing conf files and credentials
ExtraMounts []storage.VolMounts `json:"extraMounts,omitempty"`
// BackoffLimit allows to define the maximum number of retried executions (defaults to 6).
// +kubebuilder:default:=6
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:number"}
BackoffLimit *int32 `json:"backoffLimit,omitempty"`
// +kubebuilder:validation:Optional
// NetworkAttachments is a list of NetworkAttachment resource names to expose the services to the given network
NetworkAttachments []string `json:"networkAttachments,omitempty"`
// +kubebuilder:validation:Optional
// CmdLine is the command line passed to ansible-runner
CmdLine string `json:"cmdLine,omitempty"`
// +kubebuilder:validation:Optional
// InitContainers allows the passing of an array of containers that will be executed before the ansibleee execution itself
InitContainers []corev1.Container `json:"initContainers,omitempty"`
// +kubebuilder:validation:Optional
// ServiceAccountName allows to specify what ServiceAccountName do we want the ansible execution run with. Without specifying,
// it will run with default serviceaccount
ServiceAccountName string `json:"serviceAccountName,omitempty"`
// DNSConfig allows to specify custom dnsservers and search domains
// +kubebuilder:validation:Optional
DNSConfig *corev1.PodDNSConfig `json:"dnsConfig,omitempty"`
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
// Debug run the pod in debug mode without executing the ansible-runner commands
Debug bool `json:"debug"`
}

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

// Map of hashes to track e.g. job status
Hash map[string]string `json:"hash,omitempty"`

// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:io.kubernetes.conditions"}
// Conditions
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// NetworkAttachments status of the deployment pods
NetworkAttachments map[string][]string `json:"networkAttachments,omitempty"`

// +kubebuilder:validation:Enum:=Pending;Running;Succeeded;Failed
// +kubebuilder:default:=Pending
// JobStatus status of the executed job (Pending/Running/Succeeded/Failed)
JobStatus string `json:"JobStatus,omitempty" optional:"true"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
//+operator-sdk:csv:customresourcedefinitions:displayName="OpenStack Ansible EE"
//+kubebuilder:resource:shortName=osaee;osaees;osansible;osansibles
//+kubebuilder:printcolumn:name="NetworkAttachments",type="string",JSONPath=".spec.networkAttachments",description="NetworkAttachments"
//+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"

// OpenStackAnsibleEE is the Schema for the openstackansibleees API
type OpenStackAnsibleEE struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec OpenStackAnsibleEESpec `json:"spec,omitempty"`
Status OpenStackAnsibleEEStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

// Config is a specification of where to mount a certain ConfigMap object
type Config struct {
// Name is the name of the ConfigMap that we want to mount
Name string `json:"name"`
// MountPoint is the directory of the container where the ConfigMap will be mounted
MountPath string `json:"mountpath"`
}

func init() {
SchemeBuilder.Register(&OpenStackAnsibleEE{}, &OpenStackAnsibleEEList{})
}

// IsReady - returns true if the OpenStackAnsibleEE is ready
func (instance OpenStackAnsibleEE) IsReady() bool {
return instance.Status.Conditions.IsTrue(AnsibleExecutionJobReadyCondition)
}

// SetupDefaults - initializes any CRD field defaults based on environment variables (the defaulting mechanism itself is implemented via webhooks)
func SetupDefaults() {
// Acquire environmental defaults and initialize OpenStackAnsibleEE defaults with them
openstackAnsibleEEDefaults := OpenStackAnsibleEEDefaults{
ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_ANSIBLEEE_IMAGE_URL_DEFAULT", OpenStackAnsibleEEContainerImage),
}

SetupOpenStackAnsibleEEDefaults(openstackAnsibleEEDefaults)
}
Loading

0 comments on commit a363c37

Please sign in to comment.