I created a ComponentResource to install the opera...
# kubernetes
l
I created a ComponentResource to install the operator lifecycle manager however something is going wrong on parsing the yaml. The code look like that
Copy code
import pulumi
from pulumi_kubernetes.yaml import  ConfigFile

class OperatorLifecycleManager(pulumi.ComponentResource):
    def __init__(
        self,
        name: str,
        opts: pulumi.ResourceOptions,
        release: str = "0.15.1"
    ):
        super().__init__("kubernetes:module:OperatorLifecycleManager", name, None, opts)
        base_url = f"<https://github.com/operator-framework/operator-lifecycle-manager/releases/download/{release}>"
        crds_url = f"{base_url}/crds.yaml"
        olm_url = f"{base_url}/olm.yaml"
        self.crds = ConfigFile(f"{name}-crds", crds_url, opts=pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(parent=self)))
        self.olm = ConfigFile(f"{name}-olm", olm_url, opts=pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(parent=self, depends_on=[self.crds])))
The errors I'm getting is
g
I’d guess that the YAML is invalid. Haven’t looked at it, but
status
is likely not an input field
l
I downloaded the yaml and applied it manually and it worked. Could they be a difference between a kubectl vs pulumi to apply it ?
I found the root cause. Look like pulumi doesn't like the fact that the yaml resource it want to create contain a status node. removing it work.
Copy code
apiVersion: <http://apiextensions.k8s.io/v1|apiextensions.k8s.io/v1>
kind: CustomResourceDefinition
metadata:
  annotations:
    <http://controller-gen.kubebuilder.io/version|controller-gen.kubebuilder.io/version>: v0.3.0
  creationTimestamp: null
  name: <http://catalogsources.operators.coreos.com|catalogsources.operators.coreos.com>
spec:
  group: <http://operators.coreos.com|operators.coreos.com>
  names:
    categories:
    - olm
    kind: CatalogSource
    listKind: CatalogSourceList
    plural: catalogsources
    shortNames:
    - catsrc
    singular: catalogsource
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The pretty name of the catalog
      jsonPath: .spec.displayName
      name: Display
      type: string
    - description: The type of the catalog
      jsonPath: .spec.sourceType
      name: Type
      type: string
    - description: The publisher of the catalog
      jsonPath: .spec.publisher
      name: Publisher
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: CatalogSource is a repository of CSVs, CRDs, and operator packages.
        type: object
        required:
        - metadata
        - spec
        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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds>'
            type: string
          metadata:
            type: object
          spec:
            type: object
            required:
            - sourceType
            properties:
              address:
                description: 'Address is a host that OLM can use to connect to a pre-existing
                  registry. Format: <registry-host or ip>:<port> Only used when SourceType
                  = SourceTypeGrpc. Ignored when the Image field is set.'
                type: string
              configMap:
                description: ConfigMap is the name of the ConfigMap to be used to
                  back a configmap-server registry. Only used when SourceType = SourceTypeConfigmap
                  or SourceTypeInternal.
                type: string
              description:
                type: string
              displayName:
                description: Metadata
                type: string
              icon:
                type: object
                required:
                - base64data
                - mediatype
                properties:
                  base64data:
                    type: string
                  mediatype:
                    type: string
              image:
                description: Image is an operator-registry container image to instantiate
                  a registry-server with. Only used when SourceType = SourceTypeGrpc.
                  If present, the address field is ignored.
                type: string
              publisher:
                type: string
              secrets:
                description: Secrets represent set of secrets that can be used to
                  access the contents of the catalog. It is best to keep this list
                  small, since each will need to be tried for every catalog entry.
                type: array
                items:
                  type: string
              sourceType:
                description: SourceType is the type of source
                type: string
              updateStrategy:
                description: UpdateStrategy defines how updated catalog source images
                  can be discovered Consists of an interval that defines polling duration
                  and an embedded strategy type
                type: object
                properties:
                  registryPoll:
                    type: object
                    properties:
                      interval:
                        description: Interval is used to determine the time interval
                          between checks of the latest catalog source version. The
                          catalog operator polls to see if a new version of the catalog
                          source is available. If available, the latest image is pulled
                          and gRPC traffic is directed to the latest catalog source.
                        type: string
          status:
            type: object
            properties:
              configMapReference:
                type: object
                required:
                - name
                - namespace
                properties:
                  lastUpdateTime:
                    type: string
                    format: date-time
                  name:
                    type: string
                  namespace:
                    type: string
                  resourceVersion:
                    type: string
                  uid:
                    description: UID is a type that holds unique ID values, including
                      UUIDs.  Because we don't ONLY use UUIDs, this is an alias to
                      string.  Being a type captures intent and helps make sure that
                      UIDs and names do not get conflated.
                    type: string
              connectionState:
                type: object
                required:
                - lastObservedState
                properties:
                  address:
                    type: string
                  lastConnect:
                    type: string
                    format: date-time
                  lastObservedState:
                    type: string
              latestImageRegistryPoll:
                description: The last time the CatalogSource image registry has been
                  polled to ensure the image is up-to-date
                type: string
                format: date-time
              message:
                description: A human readable message indicating details about why
                  the CatalogSource is in this condition.
                type: string
              reason:
                description: Reason is the reason the CatalogSource was transitioned
                  to its current state.
                type: string
              registryService:
                type: object
                properties:
                  createdAt:
                    type: string
                    format: date-time
                  port:
                    type: string
                  protocol:
                    type: string
                  serviceName:
                    type: string
                  serviceNamespace:
                    type: string
    storage: true
    subresources:
      status: {}
    served: true
#status:
#  acceptedNames:
#    kind: ""
#    plural: ""
#  conditions: []
#  storedVersions: []
Is it the expected behavior at the step of pulumi preview ? because using kubectl it is working
raised an issue to the olm github to remove the status node from the crds spec. https://github.com/operator-framework/operator-lifecycle-manager/issues/1710
g
Thanks. kubectl is probably more permissive, but POSTing status there is out of spec