Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: etcdbackups.etcd.database.coreos.com
spec:
group: etcd.database.coreos.com
names:
kind: EtcdBackup
listKind: EtcdBackupList
plural: etcdbackups
singular: etcdbackup
scope: Namespaced
version: v1beta2
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: etcdclusters.etcd.database.coreos.com
spec:
group: etcd.database.coreos.com
names:
kind: EtcdCluster
listKind: EtcdClusterList
plural: etcdclusters
shortNames:
- etcdclus
- etcd
singular: etcdcluster
scope: Namespaced
version: v1beta2
validation:
openAPIV3Schema:
properties:
spec:
type: object
properties:
test:
type: integer
minimum: 1
maximum: 32767

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: etcd-pdb
spec:
minAvailable: 100%
selector:
matchLabels:
app: etcd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: etcdrestores.etcd.database.coreos.com
spec:
group: etcd.database.coreos.com
names:
kind: EtcdRestore
listKind: EtcdRestoreList
plural: etcdrestores
singular: etcdrestore
scope: Namespaced
version: v1beta2
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ spec:
name: etcd Community
maturity: alpha
provider:
name: CNCF
name:
replaces: etcdoperator.v0.9.2
selector:
matchLabels:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: objectbucketclaims.objectbucket.io
spec:
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
group: objectbucket.io
names:
kind: ObjectBucketClaim
listKind: ObjectBucketClaimList
plural: objectbucketclaims
singular: objectbucketclaim
shortNames:
- obc
- obcs
scope: Namespaced
subresources:
status: {}
additionalPrinterColumns:
- JSONPath: .spec.storageClassName
description: StorageClass
name: Storage-Class
type: string
- JSONPath: .status.phase
description: Phase
name: Phase
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
description: Standard object metadata.
type: object
spec:
description: Specification of the desired behavior of the claim.
properties:
storageClassName:
description: StorageClass names the StorageClass object representing the
desired provisioner and parameters
type: string
bucketName:
description: BucketName (not recommended) the name of the bucket. Caution!
In-store bucket names may collide across namespaces. If you define
the name yourself, try to make it as unique as possible.
type: string
generateBucketName:
description: GenerateBucketName (recommended) a prefix for a bucket name to be
followed by a hyphen and 5 random characters. Protects against
in-store name collisions.
type: string
additionalConfig:
description: AdditionalConfig gives providers a location to set
proprietary config values (tenant, namespace, etc)
additionalProperties:
type: string
type: object
required:
- storageClassName
type: object
status:
description: Most recently observed status of the claim.
properties:
phase:
description: ObjectBucketClaimStatusPhase is set by the controller to save the state of the provisioning process
enum:
- "pending"
- "bound"
- "released"
- "failed"
type: string
type: object
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: objectbuckets.objectbucket.io
spec:
versions:
- name: v1alpha1
served: true
storage: true
group: objectbucket.io
names:
kind: ObjectBucket
listKind: ObjectBucketList
plural: objectbuckets
singular: objectbucket
shortNames:
- ob
- obs
scope: Cluster
subresources:
status: {}
additionalPrinterColumns:
- JSONPath: .spec.storageClassName
description: StorageClass
name: Storage-Class
type: string
- JSONPath: .spec.claimRef.namespace
description: ClaimNamespace
name: Claim-Namespace
type: string
- JSONPath: .spec.claimRef.name
description: ClaimName
name: Claim-Name
type: string
- JSONPath: .spec.reclaimPolicy
description: ReclaimPolicy
name: Reclaim-Policy
type: string
- JSONPath: .status.phase
description: Phase
name: Phase
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
description: Standard object metadata.
type: object
spec:
description: Specification of the desired behavior of the bucket.
properties:
storageClassName:
description: StorageClass names the StorageClass object representing the
desired provisioner and parameters
type: string
reclaimPolicy:
description: Describes a policy for end-of-life maintenance of ObjectBucket.
enum:
- "Delete"
- "Retain"
- "Recycle"
type: string
claimRef:
description: ObjectReference to ObjectBucketClaim
type: object
endpoint:
description: Endpoint contains all connection relevant data that an app may
require for accessing the bucket
properties:
bucketHost:
description: Bucket address hostname
type: string
bucketPort:
description: Bucket address port
type: integer
bucketName:
description: Bucket name
type: string
region:
description: Bucket region
type: string
subRegion:
description: Bucket sub-region
type: string
additionalConfig:
description: AdditionalConfig gives providers a location to set
proprietary config values (tenant, namespace, etc)
additionalProperties:
type: string
type: object
type: object
additionalState:
description: additionalState gives providers a location to set
proprietary config values (tenant, namespace, etc)
additionalProperties:
type: string
type: object
required:
- storageClassName
type: object
status:
description: Most recently observed status of the bucket.
properties:
phase:
description: ObjectBucketStatusPhase is set by the controller to save the
state of the provisioning process
enum:
- "bound"
- "released"
- "failed"
type: string
type: object
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
annotations: {}
# operators.operatorframework.io.bundle.channel.default.v1: stable
# operators.operatorframework.io.bundle.channels.v1: stable,beta
# operators.operatorframework.io.bundle.manifests.v1: manifests/
# operators.operatorframework.io.bundle.mediatype.v1: registry+v1
# operators.operatorframework.io.bundle.metadata.v1: metadata/
# operators.operatorframework.io.bundle.package.v1: etcd
30 changes: 24 additions & 6 deletions pkg/lib/bundle/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ func (i imageValidator) ValidateBundleFormat(directory string) error {
}
}

if manifestsFound == false {
if !manifestsFound {
validationErrors = append(validationErrors, fmt.Errorf("Unable to locate manifests directory"))
}
if metadataFound == false {
if !metadataFound {
validationErrors = append(validationErrors, fmt.Errorf("Unable to locate metadata directory"))
}

Expand Down Expand Up @@ -278,6 +278,8 @@ func (i imageValidator) ValidateBundleContent(manifestDir string) error {
unstObjs := []*unstructured.Unstructured{}
csvValidator := v.ClusterServiceVersionValidator
crdValidator := v.CustomResourceDefinitionValidator
registryBundleValidator := validation.BundleValidator
apiBundleValidator := v.BundleValidator

// Read all files in manifests directory
items, err := ioutil.ReadDir(manifestDir)
Expand Down Expand Up @@ -367,18 +369,30 @@ func (i imageValidator) ValidateBundleContent(manifestDir string) error {
}
}

// Validate the bundle object
// Validate the registry bundle type
if len(unstObjs) > 0 {
bundle := registry.NewBundle(csvName, &registry.Annotations{}, unstObjs...)
bundleValidator := validation.BundleValidator
results := bundleValidator.Validate(bundle)
results := registryBundleValidator.Validate(bundle)
if len(results) > 0 {
for _, err := range results[0].Errors {
validationErrors = append(validationErrors, err)
}
}
}

// Validate the api bundle type
if bundle, bundleErr := manifests.GetBundleFromDir(manifestDir); bundleErr == nil {
results := apiBundleValidator.Validate(bundle)
if len(results) > 0 {
for _, err := range results[0].Errors {
validationErrors = append(validationErrors, err)
}
}
} else {
// unable to load the api bundle type
validationErrors = append(validationErrors, bundleErr)
}

// Determine if optional validations are enabled
optionalValidators := parseOptions(i.optional)

Expand All @@ -397,7 +411,11 @@ func (i imageValidator) ValidateBundleContent(manifestDir string) error {
// Run the bundle object validation if specified
if _, ok := optionalValidators[validateBundleObjectsKey]; ok {
i.logger.Debug("Performing bundle objects validation")
results := v.ObjectValidator.Validate(unstObjs)
temp := []interface{}{}
for _, unstObj := range unstObjs {
temp = append(temp, unstObj)
}
results := v.ObjectValidator.Validate(temp...)
if len(results) > 0 {
for _, err := range results[0].Errors {
validationErrors = append(validationErrors, err)
Expand Down
Loading