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

feat: Add worker configs var and handler #208

Merged
merged 5 commits into from
Oct 5, 2023

Conversation

dkoshkin
Copy link
Contributor

@dkoshkin dkoshkin commented Oct 3, 2023

This adds code to set worker overrides to clusterConfig, here is an example of how to use it:

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: <NAME>
spec:
    topology:
      class: docker-quick-start
      controlPlane:
        metadata: {}
        replicas: 1
      variables:
      - name: clusterConfig
        value:
          addons:
            cni:
              provider: calico
            nfd: {}
          controlPlane:
            docker:
              customImage: ghcr.io/mesosphere/kind-node:v1.2.3-cp
          docker: {}
      - name: workerConfig
        value:
          docker:
            customImage: ghcr.io/mesosphere/kind-node:v1.2.3-worker
      version: v1.27.5
      workers:
        machineDeployments:
        - class: default-worker
          metadata: {}
          name: md-0
          replicas: 1
        - class: default-worker
          metadata: {}
          name: md-1
          replicas: 1
          variables:
            overrides:
            - name: workerConfig
              value:
                docker:
                  customImage: ghcr.io/mesosphere/kind-node:v1.2.3-custom

@dkoshkin
Copy link
Contributor Author

dkoshkin commented Oct 4, 2023

@supershal this may be useful to look at for #199

@dkoshkin dkoshkin force-pushed the dkoshkin/feat-worker-configs branch 2 times, most recently from e836121 to 497c612 Compare October 4, 2023 21:38
@dkoshkin dkoshkin force-pushed the dkoshkin/feat-worker-configs branch 2 times, most recently from b83d898 to 696d047 Compare October 4, 2023 22:26
@dkoshkin dkoshkin force-pushed the dkoshkin/feat-worker-configs branch from 0a927f0 to ba72272 Compare October 5, 2023 16:07
@dkoshkin
Copy link
Contributor Author

dkoshkin commented Oct 5, 2023

Ok moving workerConfig to a separate variable really simplified it, working as expected:

    topology:
      class: docker-quick-start
      controlPlane:
        metadata: {}
        replicas: 1
      variables:
      - name: clusterConfig
        value:
          addons:
            cni:
              provider: calico
            nfd: {}
          controlPlane:
            docker:
              customImage: ghcr.io/mesosphere/kind-node:v1.2.3-cp
          docker: {}
      - name: workerConfig
        value:
          docker:
            customImage: ghcr.io/mesosphere/kind-node:v1.2.3-worker
      version: v1.27.5
      workers:
        machineDeployments:
        - class: default-worker
          metadata: {}
          name: md-0
          replicas: 1
        - class: default-worker
          metadata: {}
          name: md-1
          replicas: 1
          variables:
            overrides:
            - name: workerConfig
              value:
                docker:
                  customImage: ghcr.io/mesosphere/kind-node:v1.2.3-custom
- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
  kind: DockerMachineTemplate
  metadata:
    name: docker-quick-start-control-plane-pqkd9
    namespace: default
  spec:
    template:
      spec:
        customImage: ghcr.io/mesosphere/kind-node:v1.2.3-cp
        extraMounts:
        - containerPath: /var/run/docker.sock
          hostPath: /var/run/docker.sock
- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
  kind: DockerMachineTemplate
  metadata:
    name: docker-quick-start-md-0-infra-9526d
    namespace: default
  spec:
    template:
      spec:
        customImage: ghcr.io/mesosphere/kind-node:v1.2.3-worker
        extraMounts:
        - containerPath: /var/run/docker.sock
          hostPath: /var/run/docker.sock
- apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
  kind: DockerMachineTemplate
  metadata:
    name: docker-quick-start-md-1-infra-b5cjx
    namespace: default
  spec:
    template:
      spec:
        customImage: ghcr.io/mesosphere/kind-node:v1.2.3-custom
        extraMounts:
        - containerPath: /var/run/docker.sock
          hostPath: /var/run/docker.sock

@jimmidyson
Copy link
Member

Nice! I won't be able to review or try this out until Monday so help from @supershal or @faiq would be great to get this merged 🙏

@supershal
Copy link
Contributor

Nice! I won't be able to review or try this out until Monday so help from @supershal or @faiq would be great to get this merged 🙏

me and @dkoshkin just go over the PR code changes this morning. changes looks good. I will test it locally before approving it today.

@supershal
Copy link
Contributor

supershal commented Oct 5, 2023

@dkoshkin should we remove [region/variables.go] in mutation package (https://github.com/d2iq-labs/capi-runtime-extensions/blob/main/pkg/handlers/aws/mutation/region/variables.go) and its test file with this change?

and same for the docker custom Image in the mutation package.

@dkoshkin
Copy link
Contributor Author

dkoshkin commented Oct 5, 2023

@dkoshkin should we remove region/variables.go and its test file with this change?

I don't think so @supershal , that configuration is still valid. Are you seeing something in this PR that made you think that?

@supershal
Copy link
Contributor

the awsRegionVariableHandler and customImageVariableHandler are not registered anymore. their unit testing is covered by test in the clusterconfig package. https://github.com/d2iq-labs/capi-runtime-extensions/blob/main/pkg/handlers/aws/clusterconfig/variables_test.go

@dkoshkin
Copy link
Contributor Author

dkoshkin commented Oct 5, 2023

the awsRegionVariableHandler and customImageVariableHandler are not registered anymore. their unit testing is covered by test in the clusterconfig package. https://github.com/d2iq-labs/capi-runtime-extensions/blob/main/pkg/handlers/aws/clusterconfig/variables_test.go

Lets do that in a separate PR, we could do this cleanup in all handlers not just these two.

@github-actions github-actions bot added feature and removed feature labels Oct 5, 2023
@dkoshkin dkoshkin merged commit fc2ef20 into main Oct 5, 2023
13 checks passed
@dkoshkin dkoshkin deleted the dkoshkin/feat-worker-configs branch October 5, 2023 20:47
dkoshkin pushed a commit that referenced this pull request Oct 19, 2023
🤖 I have created a release *beep* *boop*
---


## 0.2.0 (2023-10-19)

<!-- Release notes generated using configuration in .github/release.yaml
at main -->

## What's Changed
### Exciting New Features 🎉
* feat: AWS cluster config patch by @jimmidyson in
#172
* feat: Combine generic variables with provider specific variables by
@jimmidyson in
#173
* feat: Use external patch for Docker provider custom image by
@jimmidyson in
#188
* feat: vendor infrastructure provider APIs by @dkoshkin in
#190
* feat: Introduce scheme and decoder helpers by @jimmidyson in
#191
* feat: add imageRegistryCredentials handler by @dkoshkin in
#174
* feat: Deploy default clusterclasses via helm by @jimmidyson in
#198
* feat: Add Calico CNI AWS ingress rules by @jimmidyson in
#206
* feat: CAPA v2.2.4 by @jimmidyson in
#211
* feat: Add worker configs var and handler by @dkoshkin in
#208
* feat: adds aws ebs config by @faiq in
#192
* feat: add AWS IAM instance profile patch by @dkoshkin in
#216
* feat: Calico 3.26.3 by @jimmidyson in
#218
* feat: add AWS instance type patch by @dkoshkin in
#217
* feat: variables and patches for AWS AMI spec by @supershal in
#225
* feat: add VPC ID and Subnet IDs patch by @dkoshkin in
#220
* feat: deploy AWS CPI by @faiq in
#229
### Fixes 🔧
* fix: bring back missing docker handlers by @dkoshkin in
#187
* fix: typo in docker cluster config api by @supershal in
#205
* fix: move provider fields under aws and docker by @dkoshkin in
#204
* fix: Correctly set external cloud provider for AWS by @jimmidyson in
#210
* fix: Adds AWS Calico installation configmap by @jimmidyson in
#212
* fix: Ensure CNI ingress rules are added to AWSCluster by @jimmidyson
in #213
* fix: Reduce log verbosity for http proxy variable not found by
@jimmidyson in
#214
* fix: Don't set AWS region as required by @dkoshkin in
#219
### Other Changes
* build: Add example files to release artifacts by @jimmidyson in
#169
* build: Add AWS clusterclass example by @jimmidyson in
#162
* refactor: Move generic handlers into generic directory by @jimmidyson
in #171
* ci: Simplify shell configuration by setting defaults by @jimmidyson in
#184
* build: Disable fortify hardener to enable local debugging by
@jimmidyson in
#186
* docs: Add more details about single var by @jimmidyson in
#185
* refactor: Move meta handlers to provider packages by @jimmidyson in
#193
* refactor: Use consistent decoder in mutators by @jimmidyson in
#196
* build: Suppress devbox envrc update notification by @jimmidyson in
#197
* build: Consistent behaviour in addons update scripts by @jimmidyson in
#207
* build: Allow past year in license header by @jimmidyson in
#209
* build: Increase golangci-lint timeout for slower GHA runners by
@jimmidyson in
#222
* refactor: Always use unstructured in patch generators by @jimmidyson
in #221
* build: Update tools by @jimmidyson in
#223
* refactor: Remove usage of non-meta handlers by @dkoshkin in
#226

## New Contributors
* @supershal made their first contribution in
#205

**Full Changelog**:
v0.1.2...v0.2.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants