Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Adds replicas to Contour API type #8

Merged
merged 1 commit into from
Sep 1, 2020

Conversation

danehans
Copy link
Contributor

  • Makefile: Set v1 as the CRD version to support CRD defaulting.
    api/v1alpha1/contour_types.go: Adds spec.replicas and status.availableReplicas fields to the Contour API type.
  • config/crd/bases/operator.projectcontour.io_contours.yaml: Generated CRD updates from changes to api/v1alpha1/contour_types.go.
    config/samples/operator_v1alpha1_contour.yaml: Removed example foo field. Note that {} is required since spec can not be null.

/assign @jpeach
/cc @youngnick @Miciah

@danehans
Copy link
Contributor Author

$ kubectl describe contours does not describe the API. Does anyone know the magic sauce to get the CRD info displayed?

// availableReplicas is the number of observed available Contour replicas
// according to the deployment.
//
// +kubebuilder:validation:Minimum=0
Copy link
Contributor

@jpeach jpeach Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really add validation to status (i.e. users don't need validation feedback on this)?

(though this particular validation seems fine)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit 0c03a81 removes the validation for availableReplicas.

@jpeach
Copy link
Contributor

jpeach commented Sep 1, 2020

$ kubectl describe contours does not describe the API. Does anyone know the magic sauce to get the CRD info displayed?

You have to add a shortName field to +kubebuilder:resource

@danehans
Copy link
Contributor Author

danehans commented Sep 1, 2020

You have to add a shortName field to +kubebuilder:resource

@jpeach I see the shortname:

$ kubectl api-resources | grep contour
contours                                       operator.projectcontour.io     true         Contour
$ kubectl get contours
NAME             AGE
contour-sample   3h17m

I did not have an instance of the contour CR when I ran kubectl describe. It works as expected now:

$ kubectl describe contours.operator.projectcontour.io
Name:         contour-sample
Namespace:    default
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"operator.projectcontour.io/v1alpha1","kind":"Contour","metadata":{"annotations":{},"name":"contour-sample","namespace":"def...
API Version:  operator.projectcontour.io/v1alpha1
Kind:         Contour
Metadata:
  Creation Timestamp:  2020-09-01T01:12:13Z
  Finalizers:
    contour.operator.projectcontour.io/finalizer
  Generation:  2
  Managed Fields:
    API Version:  operator.projectcontour.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:foo:
    Manager:      kubectl
    Operation:    Update
    Time:         2020-09-01T01:12:13Z
    API Version:  operator.projectcontour.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:finalizers:
          .:
          v:"contour.operator.projectcontour.io/finalizer":
      f:status:
    Manager:         start
    Operation:       Update
    Time:            2020-09-01T01:12:13Z
  Resource Version:  67937
  Self Link:         /apis/operator.projectcontour.io/v1alpha1/namespaces/default/contours/contour-sample
  UID:               1823839b-4ea9-490c-8e2d-b4a304cbfddd
Spec:
  Foo:  bar
Status:
Events:  <none>

@jpeach jpeach merged commit 5e781ca into projectcontour:main Sep 1, 2020
@danehans danehans deleted the api_replicas branch September 2, 2020 18:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants