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

Add kubernetes models for API server, and yaml generation #85

Merged
merged 2 commits into from
Oct 19, 2021

Conversation

cbgbt
Copy link
Contributor

@cbgbt cbgbt commented Oct 6, 2021

Issue number: #77

Description of changes:
This change adds a build step which converts our Rust models into YAML files which can be deployed to kubernetes.

Included is a client which can be used to create and update the BottlerocketNode custom resources

Testing done:
The YAML files were applied to an EKS cluster, and then a BottlerocketNodeClient was used to create a BottlerocketNode custom resource, and update its status:

$ kubectl describe brn
Name:         brn-ip-192-168-66-198.us-west-2.compute.internal
Namespace:    brupop-bottlerocket-aws
Labels:       <none>
Annotations:  <none>
API Version:  brupop.bottlerocket.aws/v1
Kind:         BottlerocketNode
Metadata:
  Creation Timestamp:  2021-10-05T19:41:03Z
  Generation:          1
  Managed Fields:
    API Version:  brupop.bottlerocket.aws/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:ownerReferences:
          .:
          k:{"uid":"623ca9b3-bfc6-4c0f-b5d8-d8bd320a0a2f"}:
            .:
            f:apiVersion:
            f:kind:
            f:name:
            f:uid:
      f:spec:
        .:
        f:state:
        f:version:
      f:status:
        .:
        f:available_versions:
        f:current_state:
        f:current_version:
    Manager:    unknown
    Operation:  Update
    Time:       2021-10-05T19:41:03Z
  Owner References:
    API Version:     v1
    Kind:            BottlerocketNode
    Name:            ip-192-168-66-198.us-west-2.compute.internal
    UID:             623ca9b3-bfc6-4c0f-b5d8-d8bd320a0a2f
  Resource Version:  36761
  UID:               0d69e179-dbda-4058-bf4f-8e099b517a52
Spec:
  State:    WaitingForUpdate
  Version:  <nil>
Status:
  available_versions:
    1.3.0
  current_state:    WaitingForUpdate
  current_version:  1.2.1
Events:             <none>

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@cbgbt cbgbt added this to the brupop 0.2.0 milestone Oct 6, 2021
@cbgbt cbgbt force-pushed the 0.2.0-model-generation branch 2 times, most recently from 85b2be5 to 3422555 Compare October 6, 2021 18:24
@cbgbt cbgbt linked an issue Oct 7, 2021 that may be closed by this pull request
@cbgbt cbgbt changed the base branch from 0.2.0 to 0.2.0-docker-build October 7, 2021 20:46
@cbgbt cbgbt marked this pull request as ready for review October 7, 2021 20:48
@cbgbt cbgbt changed the base branch from 0.2.0-docker-build to 0.2.0 October 11, 2021 19:57
Copy link

@arnaldo2792 arnaldo2792 left a comment

Choose a reason for hiding this comment

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

👢

models/src/namespace.rs Show resolved Hide resolved
models/src/apiserver.rs Outdated Show resolved Hide resolved
models/src/node.rs Outdated Show resolved Hide resolved
models/src/node.rs Outdated Show resolved Hide resolved
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
pub struct BottlerocketNodeStatus {
current_version: String,
available_versions: Vec<String>,
Copy link
Member

Choose a reason for hiding this comment

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

available_versions might be an empty Vec which means current version is the latest version, I think it's better to use Option<Vec<String>>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's only best to wrap a Vec in Option if there is a meaningful distinction between an empty vector, and a null one. In this case, both represent the absence of updates, so it's probably best to only allow a single representation of it if possible. I think not using Option is more clear here.

@cbgbt cbgbt merged commit fc71b8b into 0.2.0 Oct 19, 2021
@cbgbt cbgbt deleted the 0.2.0-model-generation branch October 21, 2021 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

brupop 0.2.0 apiserver: Create k8s deployment targets for development
4 participants