Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose the spec change for CRD #3

Merged
merged 1 commit into from
Oct 15, 2019

Conversation

swapnilgm
Copy link

@swapnilgm swapnilgm commented Oct 1, 2019

Signed-off-by: Swapnil Mhamane [email protected]

** What this PR does? **
I have updated the PR.

  • Updated the CRD spec.
  • Changed api version from v1 to v1alpha1
  • Changed the domain from sapcloud.io -> gardener.cloud

** Comments for reviewers **
⚠️ As there are some spec field changes from variable to pointer. The controller logic doesn't have associated changes like nil checks. This PR is made ready enough to unblock @georgekuruvillak
and work ahead with CRD spec. Controller logic needs to be updated accordingly.

I'm not sure about introducing all those fields all the fields from start in status. We should introduce fields as and when we are sure that we require it. But since i'm not yet completely gone through the controller logic, and considering other task priorities, may i'll propose the status changes in separate PR later on. Till then @georgekuruvillak it would be nice if you could keep it to minimum.

@swapnilgm swapnilgm requested a review from a team as a code owner October 1, 2019 05:54
@@ -398,7 +406,7 @@ spec:
#default: 10485760
deltaSnapshotPeriod:
type: string
#default: 60s
default: 60s

Choose a reason for hiding this comment

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

defaults are in alpha and will work from 1.16

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for info. I just kind of cherry picked from old PR. Will go though it again. Also, i will try to change the CRD version from v1 to v1alpha1

// +optional
Password string `json:"password,omitempty"`
// +required
InitialClusterToken string `json:"initialClusterToken"`

Choose a reason for hiding this comment

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

Should we remove InitialCluster details? It may come in handy when we go multi instance. Or do we add it then?

Copy link
Author

Choose a reason for hiding this comment

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

Yes. Precisely we are not yet sure about the mutli node setup. We can make if configurable better later than now.

Copy link
Collaborator

@amshuman-kr amshuman-kr left a comment

Choose a reason for hiding this comment

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

I have made some suggestions. Could you PTAL?

api/v1/etcd_types.go Outdated Show resolved Hide resolved
api/v1/etcd_types.go Outdated Show resolved Hide resolved
api/v1/etcd_types.go Outdated Show resolved Hide resolved
Replicas *int32 `json:"replicas,omitempty"`
ReadyReplicas *int32 `json:"readyReplicas,omitempty"`
Ready *bool `json:"ready,omitempty"`
UpdatedReplicas *int32 `json:"updatedReplicas,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

We will need a LabelSelector field in the Status if we want to implement Scale sub-resource, which we should.

Copy link
Author

Choose a reason for hiding this comment

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

LabeSelector is optional. So, didn't introduced here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is optional but the default behaviour if it is not supplied is quite useless. So, might be good to have it.

If there is no value under the LabelSelectorPath in the custom resource, the status selector value in the /scale subresource will default to the empty string.

Also,

It must be set to work with HPA.

Though we don't want to use HPA with our CRD but you never know which other component working with the Scale subresource expects a proper value here.

api/v1alpha1/groupversion_info.go Outdated Show resolved Hide resolved
@swapnilgm
Copy link
Author

swapnilgm commented Oct 1, 2019

@georgekuruvillak @amshuman-kr This is kind of cherry pick PR from old PR. I'll notify you once it is ready for review. Please don't waste you time on reviewing it now. Said that thanks for the suggestions provided till now.

# statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.
statusReplicasPath: .status.replicas
# labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.
# labelSelectorPath: .status.labelSelector

Choose a reason for hiding this comment

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

Why is this commented? This should be required, right?

Copy link
Author

Choose a reason for hiding this comment

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

Nope. its optional.

Copy link
Author

@swapnilgm swapnilgm Oct 3, 2019

Choose a reason for hiding this comment

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

As Amshu suggested will uncomment it and add filed in status.

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 Thanks.

@swapnilgm swapnilgm changed the title [WIP] Propose the spec change for CRD Propose the spec change for CRD Oct 1, 2019
@swapnilgm
Copy link
Author

@amshuman-kr @georgekuruvillak This PR is ready for review. Please go though the description for scope of the PR.

Copy link
Collaborator

@amshuman-kr amshuman-kr left a comment

Choose a reason for hiding this comment

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

LGTM except for the missing pod label selector in the status.

README.md Outdated
Comment on lines 34 to 35
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"druid.sapcloud.io/v1","kind":"Etcd","metadata":{"annotations":{},"labels":{"app":"etcd-statefulset","garden.sapcloud.io/role":"controlplane","role":"test"},"name":"test","namespace":"shoot--dev--i308301-1"},"spec":{"annotations":{"app":"etcd-statefulset","garden.sapcloud.io/role":"controlplane","networking.gardener.cloud/to-dns":"allowed","networking.gardener.cloud/to-private-networks":"allowed","networking.gardener.cloud/to-public-networks":"allowed","role":"test"},"backup":{"deltaSnapshotMemoryLimit":104857600,"deltaSnapshotPeriod":"300s","etcdConnectionTimeout":"300s","etcdQuotaBytes":8589934592,"fullSnapshotSchedule":"0 */24 * * *","garbageCollectionPeriod":"43200s","garbageCollectionPolicy":"Exponential","imageRepository":"eu.gcr.io/gardener-project/gardener/etcdbrctl","imageVersion":"0.8.0-dev","port":8080,"pullPolicy":"IfNotPresent","resources":{"limits":{"cpu":"500m","memory":"2Gi"},"requests":{"cpu":"23m","memory":"128Mi"}},"snapstoreTempDir":"/var/etcd/data/temp"},"etcd":{"clientPort":2379,"defragmentationSchedule":"0 */24 * * *","enableTLS":false,"imageRepository":"quay.io/coreos/etcd","imageVersion":"v3.3.13","initialClusterState":"new","initialClusterToken":"new","metrics":"basic","pullPolicy":"IfNotPresent","resources":{"limits":{"cpu":"2500m","memory":"4Gi"},"requests":{"cpu":"500m","memory":"1000Mi"}},"serverPort":2380,"storageCapacity":"80Gi","storageClass":"gardener.cloud-fast"},"labels":{"app":"etcd-statefulset","garden.sapcloud.io/role":"controlplane","networking.gardener.cloud/to-dns":"allowed","networking.gardener.cloud/to-private-networks":"allowed","networking.gardener.cloud/to-public-networks":"allowed","role":"test"},"pvcRetentionPolicy":"DeleteAll","replicas":1,"storageCapacity":"80Gi","storageClass":"gardener.cloud-fast","store":{"storageContainer":"shoot--dev--i308301-1--b3caa","storageProvider":"S3","storePrefix":"etcd-test","storeSecret":"etcd-backup"},"tlsClientSecret":"etcd-client-tls","tlsServerSecret":"etcd-server-tls"}}
{"apiVersion":"druid.gardener.cloud/v1","kind":"Etcd","metadata":{"annotations":{},"labels":{"app":"etcd-statefulset","garden.sapcloud.io/role":"controlplane","role":"test"},"name":"test","namespace":"shoot--dev--i308301-1"},"spec":{"annotations":{"app":"etcd-statefulset","garden.sapcloud.io/role":"controlplane","networking.gardener.cloud/to-dns":"allowed","networking.gardener.cloud/to-private-networks":"allowed","networking.gardener.cloud/to-public-networks":"allowed","role":"test"},"backup":{"deltaSnapshotMemoryLimit":104857600,"deltaSnapshotPeriod":"300s","etcdConnectionTimeout":"300s","etcdQuotaBytes":8589934592,"fullSnapshotSchedule":"0 */24 * * *","garbageCollectionPeriod":"43200s","garbageCollectionPolicy":"Exponential","imageRepository":"eu.gcr.io/gardener-project/gardener/etcdbrctl","imageVersion":"0.8.0-dev","port":8080,"pullPolicy":"IfNotPresent","resources":{"limits":{"cpu":"500m","memory":"2Gi"},"requests":{"cpu":"23m","memory":"128Mi"}},"snapstoreTempDir":"/var/etcd/data/temp"},"etcd":{"clientPort":2379,"defragmentationSchedule":"0 */24 * * *","enableTLS":false,"imageRepository":"quay.io/coreos/etcd","imageVersion":"v3.3.13","initialClusterState":"new","initialClusterToken":"new","metrics":"basic","pullPolicy":"IfNotPresent","resources":{"limits":{"cpu":"2500m","memory":"4Gi"},"requests":{"cpu":"500m","memory":"1000Mi"}},"serverPort":2380,"storageCapacity":"80Gi","storageClass":"gardener.cloud-fast"},"labels":{"app":"etcd-statefulset","garden.sapcloud.io/role":"controlplane","networking.gardener.cloud/to-dns":"allowed","networking.gardener.cloud/to-private-networks":"allowed","networking.gardener.cloud/to-public-networks":"allowed","role":"test"},"pvcRetentionPolicy":"DeleteAll","replicas":1,"storageCapacity":"80Gi","storageClass":"gardener.cloud-fast","store":{"storageContainer":"shoot--dev--i308301-1--b3caa","storageProvider":"S3","storePrefix":"etcd-test","storeSecret":"etcd-backup"},"tlsClientSecret":"etcd-client-tls","tlsServerSecret":"etcd-server-tls"}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please delete this.

api/v1alpha1/etcd_types.go Show resolved Hide resolved
@swapnilgm swapnilgm force-pushed the refator/crd-spec branch 2 times, most recently from 273086f to 0a6c7ed Compare October 3, 2019 14:24
Copy link

@georgekuruvillak georgekuruvillak left a comment

Choose a reason for hiding this comment

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

Thanks for spending time to refactor. The spec looks nicer. I shall merge and fix any errors that may have resulted as part of the changes.

Copy link
Collaborator

@amshuman-kr amshuman-kr left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Swapnil Mhamane <[email protected]>
@swapnilgm
Copy link
Author

Rebased and removed conflicts.

@georgekuruvillak georgekuruvillak merged commit bb34d88 into gardener:master Oct 15, 2019
@swapnilgm swapnilgm deleted the refator/crd-spec branch October 15, 2019 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants