Code Monkey home page Code Monkey logo

operator-sdk's Introduction

Neon.Operator: Potentially useful libraries published as NuGet packages

.NET Test NuGet Version

Slack


Documentation:

Neon.Operator is an open source project released under the Apache-2.0 license.

operator-sdk's People

Contributors

carohagg avatar jefflill avatar marcusbooyah avatar markciliavincenti avatar neonforgedevbot avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

operator-sdk's Issues

Generated rolebinding YAML is malformed

I've pulled master for all NEONFORGE repos and am seeing malformed rolebinding files being generated for neon-cluster-operator and neon-cluster-agent. Here's an example:

image

OperatorSDK not generating CS files for MSBUILD?

It appears that the OperatorSDK is not generating when building using MSBUILD:

C:\src\neonKUBE\Services\neon-cluster-operator\OperatorStartup.cs(91,18): error CS1061: 'IServiceCollection' does not contain a definition for 'AddKubernetesOperator' and no accessible extension method 'AddKubernetesOperator' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?) [C:\src\neonKUBE\Services\neon-cluster-operator\neon-cluster-operator.csproj]
C:\src\neonKUBE\Services\neon-cluster-operator\OperatorStartup.cs(105,17): error CS1061: 'IApplicationBuilder' does not contain a definition for 'UseKubernetesOperator' and no accessible extension method 'UseKubernetesOperator' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?) [C:\src\neonKUBE\Services\neon-cluster-operator\neon-cluster-operator.csproj]

I've noticed that when I open the NEONCLOUD solution with :\src\neonKUBE\Services\neon-cluster-operator\OperatorStartup.cs open that it takes sometime for the call to UseKubernetesOperator() there turns blue, indicating that the method has been generated and is actually valid. I also notice that the code is generated in a user temp directory and not in a git folder, so we can't rely on source files generated previously in a VS session that gets committed to GitHub.

I wonder if there's a way to have MSBUILD run all analyzers before building?

Subclass constants don't work

public static class Constants
{
    public static class Olm
    {
        public const string OperatorName = "garnet-operator";
    }
}

Referencing the above like this doesn't work

[assembly: Name(Name = Constants.Olm.OperatorName)]

Enum validation

Enum validation for Custom Resource Definitions is currently not supported.

Generated namespaced roles need to specify the namespace?

The neon-cluster-operator service specifies the following RBAC rules:

[RbacRule<V1ConfigMap>(Verbs = RbacVerb.All, Scope = EntityScope.Cluster)]
[RbacRule<V1Secret>(Verbs = RbacVerb.All, Scope = EntityScope.Cluster)]
[RbacRule<V1Pod>(Verbs = RbacVerb.List, Scope = EntityScope.Namespaced, Namespace = KubeNamespace.NeonSystem)]
public partial class Service : NeonService

The OperatorSDK generates two role files:

clusterrole-neon-cluster-operator.yaml
role-neon-cluster-operator.yaml

clusterrole-neon-cluster-operator.yaml looks OK:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: neon-cluster-operator
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  - namespaces
  - nodes
  - pods
  - secrets
  verbs:
  - '*'
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - get
  - update
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - mutatingwebhookconfigurations
  verbs:
  - '*'
- apiGroups:
  - minio.min.io
  resources:
  - tenants
  verbs:
  - '*'
- apiGroups:
  - minio.neonkube.io
  resources:
  - miniobuckets
  - miniobuckets/status
  verbs:
  - '*'
- apiGroups:
  - neonkube.io
  resources:
  - crioconfigurations
  - crioconfigurations/status
  - neonclusterjobs
  - neonclusterjobs/status
  - neoncontainerregistries
  - neoncontainerregistries/status
  - neondashboards
  - neondashboards/status
  - neonnodetasks
  - neonnodetasks/status
  - neonssocallbackurls
  - neonssocallbackurls/status
  - neonssoclients
  - neonssoclients/status
  verbs:
  - '*'

but role-neon-cluster-operator.yaml should be specifying the target namespace in it's metadata, right?

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: neon-cluster-operator
rules:
- apiGroups:
  - ""
  resourceNames:
  - neon-sso-oauth2-proxy
  resources:
  - configmaps
  verbs:
  - get
  - update
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - list
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - get
- apiGroups:
  - ""
  resourceNames:
  - neon-cluster-operator-webhook-tls
  resources:
  - secrets
  verbs:
  - watch
- apiGroups:
  - cert-manager.io
  resources:
  - certificates
  verbs:
  - '*'
- apiGroups:
  - coordination.k8s.io
  resources:
  - leases
  verbs:
  - '*'

So, I think the namespace role is actually being applied only to the default namespace right now.

Note that it's possible for a service to reference multiple namespaces, so you'll need to generate multiple role manifests in this file, one per referenced namespace, separating these with "---" lines.

OperatorSDK generated files with [.osdk.yaml] file type

What would you think of having the OperatorSDK generated file have a unique file type like .osdk.yaml, ogen.yaml, or something?

The idea here is to make it easy to .gitignore all of these files. Right now, we're explicitly ignoring these by path, but that's fragile because it's very possible to to add a new RBAC conditions that will generate new files that will probably get tracked by Git until we figure that out and have to manually ignore them,

OperatorHub packaging

It would be nice to generate the bundle needed for publishing to OperatorHub.io

Contributing

The main idea is to configure this by using assembly attributes.

[assembly: global::Neon.Operator.Attributes.OperatorName("example-operator")]
[assembly: global::Neon.Operator.Attributes.OperatorDisplayName("ExampleOperator")]
[assembly: global::Neon.Operator.Attributes.OperatorDescription("This is an example operator.")]
  • Define V1ClusterServiceVersion resource in Neon.Kubernetes.Resources. See spec and example.
  • Define Assembly Attributes for properties that should be configurable in the CSV.
    • Name
    • DisplayName
    • Annotation
    • Description
    • Keyword
    • Maintainer
    • Maturity
    • Provider
    • Version
    • MinKubeVersion
    • InstallMode
    • OwnedResource
    • OwnedResource<T>
    • RequiredResource
    • RequiredResource<T>

Example:

[AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
public sealed class OperatorNameAttribute : Attribute
{
    public string Name { get; set; }
    public OperatorNameAttribute(string name)
    {
        this.Name = name;
    }
}
  • Generate the operator.clusterserviceversion.yaml. We will use the assembly attributes from above to define these settings
  • Generate annotations.yaml
  • Generate the Dockerfile

Support selectors

The Xunit lib should support fieldSelector and labelSelector in the API server.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.