Work v1alpha1

apiVersion: work.karmada.io/v1alpha1

import "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"

Work

Work defines a list of resources to be deployed on the member cluster.


  • apiVersion: work.karmada.io/v1alpha1

  • kind: Work

  • metadata (ObjectMeta)

  • spec (WorkSpec), required

    Spec represents the desired behavior of Work.

  • status (WorkStatus)

    Status represents the status of PropagationStatus.

WorkSpec

WorkSpec defines the desired state of Work.


  • workload (WorkloadTemplate)

    Workload represents the manifest workload to be deployed on managed cluster.

    WorkloadTemplate represents the manifest workload to be deployed on managed cluster.

    • workload.manifests ([]Manifest)

      Manifests represents a list of Kubernetes resources to be deployed on the managed cluster.

      Manifest represents a resource to be deployed on managed cluster.

WorkStatus

WorkStatus defines the observed state of Work.


  • conditions ([]Condition)

    Conditions contain the different condition statuses for this work. Valid condition types are: 1. Applied represents workload in Work is applied successfully on a managed cluster. 2. Progressing represents workload in Work is being applied on a managed cluster. 3. Available represents workload in Work exists on the managed cluster. 4. Degraded represents the current state of workload does not match the desired state for a certain period.

    Condition contains details for one aspect of the current state of this API Resource.

    • conditions.lastTransitionTime (Time), required

      lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.

      Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.

    • conditions.message (string), required

      message is a human readable message indicating details about the transition. This may be an empty string.

    • conditions.reason (string), required

      reason contains a programmatic identifier indicating the reason for the condition’s last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.

    • conditions.status (string), required

      status of the condition, one of True, False, Unknown.

    • conditions.type (string), required

      type of condition in CamelCase or in foo.example.com/CamelCase.

    • conditions.observedGeneration (int64)

      observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.

  • manifestStatuses ([]ManifestStatus)

    ManifestStatuses contains running status of manifests in spec.

    ManifestStatus contains running status of a specific manifest in spec.

    • manifestStatuses.identifier (ResourceIdentifier), required

      Identifier represents the identity of a resource linking to manifests in spec.

      ResourceIdentifier provides the identifiers needed to interact with any arbitrary object.

      • manifestStatuses.identifier.kind (string), required

        Kind is the kind of the resource.

      • manifestStatuses.identifier.name (string), required

        Name is the name of the resource

      • manifestStatuses.identifier.ordinal (int32), required

        Ordinal represents an index in manifests list, so the condition can still be linked to a manifest even though manifest cannot be parsed successfully.

      • manifestStatuses.identifier.resource (string), required

        Resource is the resource type of the resource

      • manifestStatuses.identifier.version (string), required

        Version is the version of the resource.

      • manifestStatuses.identifier.group (string)

        Group is the group of the resource.

      • manifestStatuses.identifier.namespace (string)

        Namespace is the namespace of the resource, the resource is cluster scoped if the value is empty

    • manifestStatuses.health (string)

      Health represents the healthy state of the current resource. There maybe different rules for different resources to achieve health status.

    • manifestStatuses.status (RawExtension)

      Status reflects running status of current manifest.

      *RawExtension is used to hold extensions in external versions.

      To use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.

      // Internal package:

      1. type MyAPIObject struct [
      2. runtime.TypeMeta `json:",inline"`
      3. MyPlugin runtime.Object `json:"myPlugin"`
      4. ]
      5. type PluginA struct [
      6. AOption string `json:"aOption"`
      7. ]

      // External package:

      1. type MyAPIObject struct [
      2. runtime.TypeMeta `json:",inline"`
      3. MyPlugin runtime.RawExtension `json:"myPlugin"`
      4. ]
      5. type PluginA struct [
      6. AOption string `json:"aOption"`
      7. ]

      // On the wire, the JSON will look something like this:

      1. [
      2. "kind":"MyAPIObject",
      3. "apiVersion":"v1",
      4. "myPlugin": [
      5. "kind":"PluginA",
      6. "aOption":"foo",
      7. ],
      8. ]

      So what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package’s DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)*

WorkList

WorkList is a collection of Work.


  • apiVersion: work.karmada.io/v1alpha1

  • kind: WorkList

  • metadata (ListMeta)

  • items ([][Work](../work-resources/work-v1alpha1#work)), required

    Items holds a list of Work.

Operations


get read the specified Work

HTTP Request

GET /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works/{name}

Parameters

  • name (in path): string, required

    name of the Work

  • namespace (in path): string, required

    namespace

  • pretty (in query): string

    pretty

Response

200 (Work): OK

get read status of the specified Work

HTTP Request

GET /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works/{name}/status

Parameters

  • name (in path): string, required

    name of the Work

  • namespace (in path): string, required

    namespace

  • pretty (in query): string

    pretty

Response

200 (Work): OK

list list or watch objects of kind Work

HTTP Request

GET /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works

Parameters

Response

200 (WorkList): OK

list list or watch objects of kind Work

HTTP Request

GET /apis/work.karmada.io/v1alpha1/works

Parameters

Response

200 (WorkList): OK

create create a Work

HTTP Request

POST /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works

Parameters

Response

200 (Work): OK

201 (Work): Created

202 (Work): Accepted

update replace the specified Work

HTTP Request

PUT /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works/{name}

Parameters

  • name (in path): string, required

    name of the Work

  • namespace (in path): string, required

    namespace

  • body: Work, required

  • dryRun (in query): string

    dryRun

  • fieldManager (in query): string

    fieldManager

  • fieldValidation (in query): string

    fieldValidation

  • pretty (in query): string

    pretty

Response

200 (Work): OK

201 (Work): Created

update replace status of the specified Work

HTTP Request

PUT /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works/{name}/status

Parameters

  • name (in path): string, required

    name of the Work

  • namespace (in path): string, required

    namespace

  • body: Work, required

  • dryRun (in query): string

    dryRun

  • fieldManager (in query): string

    fieldManager

  • fieldValidation (in query): string

    fieldValidation

  • pretty (in query): string

    pretty

Response

200 (Work): OK

201 (Work): Created

patch partially update the specified Work

HTTP Request

PATCH /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works/{name}

Parameters

  • name (in path): string, required

    name of the Work

  • namespace (in path): string, required

    namespace

  • body: Patch, required

  • dryRun (in query): string

    dryRun

  • fieldManager (in query): string

    fieldManager

  • fieldValidation (in query): string

    fieldValidation

  • force (in query): boolean

    force

  • pretty (in query): string

    pretty

Response

200 (Work): OK

201 (Work): Created

patch partially update status of the specified Work

HTTP Request

PATCH /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works/{name}/status

Parameters

  • name (in path): string, required

    name of the Work

  • namespace (in path): string, required

    namespace

  • body: Patch, required

  • dryRun (in query): string

    dryRun

  • fieldManager (in query): string

    fieldManager

  • fieldValidation (in query): string

    fieldValidation

  • force (in query): boolean

    force

  • pretty (in query): string

    pretty

Response

200 (Work): OK

201 (Work): Created

delete delete a Work

HTTP Request

DELETE /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works/{name}

Parameters

Response

200 (Status): OK

202 (Status): Accepted

deletecollection delete collection of Work

HTTP Request

DELETE /apis/work.karmada.io/v1alpha1/namespaces/{namespace}/works

Parameters

Response

200 (Status): OK