mt-sre / addon-metadata-operator Goto Github PK
View Code? Open in Web Editor NEWOperator responsible for managing AddOn resources in OSD
License: Apache License 2.0
Operator responsible for managing AddOn resources in OSD
License: Apache License 2.0
Here is a list of metadata validation to be performed:
Goals:
Proposal:
Was thinking about using go-playground/vaidator
and the RegisterStructValidation
interface. Go-playground provides an easy way to perform:
RegisterStructValidation
+ validate.Struct(...)
)// --- cross field validation ---
// type StructLevelFunc func(sl validator.StructLevel)
// func (v *Validate) RegisterStructValidation(fn StructLevelFunc, types ...interface{})
// Example: https://github.com/go-playground/validator/blob/master/_examples/struct-level/main.go
type AddonMetadata struct {
// define fields and a validation tag for field-level validation
}
var validate *validator.Validate
func main() {
validate = validator.New()
for _, fn := range getAllValidationFuncs() {
validate.RegisterStructValidation(fn, AddonMetadata{})
}
// perform struct level validation against instances of AddonMetadata{} type
err := validate.Struct(<addon_struct>)
}
func getAllValidationFuncs() []validator.StructLevelFunc {
res := make([]validator.StructLevelFunc)
res = append(res, MetadataStructLevelValidation)
// add more
return res
}
func MetadataStructLevelValidation(sl validator.StructLevel) {
addonMetadata := sl.Current().Interface().(AddonMetadata)
// validate something at the struct level (get access to all fields)
}
DeadmansSnitchIntegration
field snitchNamePostFix
is present and does not start with hive-
addOnRequirements
key was present twice without causing error)
tasks/check/01_test_duplicated.py
<= why are there exceptions? why not all fields?targetNamespace
is present in the namespaces
listredhat-
tasks/check/09_test_namespaces.py
<= why exceptions?tasks/check/10_test_harness.py
icon
is base64 encoded, and is valid tasks/check/20_test_icon.py
ocmQuotaName
has an addon SKU in OCM tasks/check/30_test_metadata.py
addOnParameters
with their provided validation
field tasks/check/40_test_addon_parameters.py
Channels
name are part of enum (alpha, beta, stable, edge, rc)link
points to a HTTP doc (exists)relatedImages
from imagesets
:
quay.io
for now -> make it extensible)devtools
private CatalogSource.defaultChannel
is listed in the list of channels
namespaces
are given access to us through backplane (example for RHODS: https://github.com/openshift/managed-cluster-config/blob/master/deploy/backplane/mtsre/managed-odh/)
SubjectPermission
type from https://github.com/openshift/rbac-permissions-operator/blob/master/pkg/apis/managed/v1alpha1/subjectpermission_types.goaddon.yaml:installMode
is present in CSV:spec.installModes
/w supported: True
operatorName
matches the top currentCSV
name (tasks/check/01_test_csv.py
)csv
are valid
replaces
directive if an older version already existsdefaultChannel
from metadata matches annotations.yaml+defaultChannel
skipRange:
directive: https://v0-18-z.olm.operatorframework.io/docs/concepts/olm-architecture/operator-catalog/creating-an-update-graph/#skiprange# makes 1.0.0,1.0.1,1.0.2 uninstallable
metadata:
name: myoperator.v1.0.3
annotations:
olm.skipRange: ">=1.0.0 <1.0.3"
targetNamespace
should match namespace
in CSV to make sure the OperatorGroup lives in same namespace as CSVpkgName
from the annotations.yaml
file (operators.operatorframework.io.bundle.package.v1: <pkgName>
) - matches the operatorName
from the metadata. This is because the Subscription object that is created uses the operatorName
to find the pkgname. (The template says {{ ADDON.metadata['id'] }}
but it is patched by tasks/deploy/50_post_SelectorSyncSet.py
) <-- probably should improve clarity of what gets templated hereA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.