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

Use machine API types #663

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions cmd/wing/cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ package cmd
import (
"github.com/spf13/cobra"

"github.com/jetstack/tarmak/pkg/apis/wing/common"
"github.com/jetstack/tarmak/pkg/wing"
)

var agentFlags = &wing.Flags{}
var agentFlags = &common.Flags{}

var agentCmd = &cobra.Command{
Use: "agent",
Expand All @@ -21,7 +22,8 @@ func init() {
agentCmd.Flags().StringVar(&agentFlags.ClusterName, "cluster-name", "myenv-mycluster", "this specifies the cluster name [environment]-[cluster]")
agentCmd.Flags().StringVar(&agentFlags.ServerURL, "server-url", "https://localhost:9443", "this specifies the URL to the wing server")
agentCmd.Flags().StringVar(&agentFlags.ManifestURL, "manifest-url", "", "this specifies the URL where the puppet.tar.gz can be found")
agentCmd.Flags().StringVar(&agentFlags.InstanceName, "instance-name", wing.DefaultInstanceName, "this specifies the instance's name")
agentCmd.Flags().StringVar(&agentFlags.MachineName, "instance-name", wing.DefaultMachineName, "this specifies the instance's name")
agentCmd.Flags().StringVar(&agentFlags.Pool, "pool", "", "this specifies the instance pool the machine resides in, used as a label selector")

RootCmd.AddCommand(agentCmd)
}
1 change: 1 addition & 0 deletions docs/generated/cmd/wing/wing_agent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Options
-h, --help help for agent
--instance-name string this specifies the instance's name (default "$(hostname)")
--manifest-url string this specifies the URL where the puppet.tar.gz can be found
--pool string this specifies the instance pool the machine resides in, used as a label selector
--server-url string this specifies the URL to the wing server (default "https://localhost:9443")

Options inherited from parent commands
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/cmd/wing/wing_server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Options

::

--admission-control strings Admission is divided into two phases. In the first phase, only mutating admission plugins run. In the second phase, only validating admission plugins run. The names in the below list may represent a validating plugin, a mutating plugin, or both. Within each phase, the plugins will run in the order in which they are passed to this flag. Comma-delimited list of: Initializers, InstanceInitTime, MutatingAdmissionWebhook, NamespaceLifecycle, ValidatingAdmissionWebhook. (default [InstanceInitTime])
--admission-control strings Admission is divided into two phases. In the first phase, only mutating admission plugins run. In the second phase, only validating admission plugins run. The names in the below list may represent a validating plugin, a mutating plugin, or both. Within each phase, the plugins will run in the order in which they are passed to this flag. Comma-delimited list of: Initializers, MachineDeploymentInitTime, MachineInitTime, MachineSetInitTime, MutatingAdmissionWebhook, NamespaceLifecycle, ValidatingAdmissionWebhook. (default [MachineInitTime,MachineSetInitTime,MachineDeploymentInitTime])
--admission-control-config-file string File with admission control configuration.
--bind-address ip The IP address on which to listen for the --secure-port port. The associated interface(s) must be reachable by the rest of the cluster, and by CLI/web clients. If blank, all interfaces will be used (0.0.0.0). (default 0.0.0.0)
--cert-dir string The directory where the TLS certs are located. If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored. (default "apiserver.local.config/certificates")
Expand Down
8 changes: 7 additions & 1 deletion docs/generated/reference/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ resource_categories:
- name: "Cluster"
version: "v1alpha1"
group: "cluster"
- name: "Instance"
- name: "Machine"
version: "v1alpha1"
group: "wing"
- name: "MachineSet"
version: "v1alpha1"
group: "wing"
- name: "MachineDeployment"
version: "v1alpha1"
group: "wing"
568 changes: 476 additions & 92 deletions docs/generated/reference/output/api-docs.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/generated/reference/output/navData.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions hack/update-cmd-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ OUTPUT_DIR="${CMD_ROOT}"
BINDIR=$REPO_ROOT/bin
HACKDIR=$REPO_ROOT/hack

echo "+++ Building cmd-gen"
go build -o ${BINDIR}/cmd-gen ./hack/cmd-gen

echo "+++ Removing old output"
rm -Rf "${OUTPUT_DIR}"
mkdir -p "${OUTPUT_DIR}"

echo "+++ Building cmd-gen"
go build -o ${BINDIR}/cmd-gen ./hack/cmd-gen

echo "+++ Running cmd-gen"
${BINDIR}/cmd-gen ${OUTPUT_DIR}

Expand Down
24 changes: 24 additions & 0 deletions pkg/apis/wing/common/consts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright Jetstack Ltd. See LICENSE for details.
package common

const (
MachineManifestStateConverging = MachineManifestState("converging")
MachineManifestStateConverged = MachineManifestState("converged")
MachineManifestStateError = MachineManifestState("error")

// Replace the old MachineSet by new one using rolling update
// i.e gradually scale down the old MachineSet and scale up the new one.
RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate"
)

type MachineStatusError string
type MachineManifestState string
type MachineDeploymentStrategyType string

type Flags struct {
ManifestURL string
ServerURL string
ClusterName string
MachineName string
Pool string
}
38 changes: 18 additions & 20 deletions pkg/apis/wing/types.go → pkg/apis/wing/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,43 @@ package wing

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/jetstack/tarmak/pkg/apis/wing/common"
)

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type Instance struct {
type Machine struct {
metav1.TypeMeta
metav1.ObjectMeta

InstanceID string
InstancePool string

Spec *InstanceSpec
Status *InstanceStatus
Spec *MachineSpec
Status *MachineStatus
}

// InstanceSpec defines the desired state of Instance
type InstanceSpec struct {
Converge *InstanceSpecManifest
DryRun *InstanceSpecManifest
// MachineSpec defines the desired state of Machine
type MachineSpec struct {
Converge *MachineSpecManifest
DryRun *MachineSpecManifest
}

// InstaceSpecManifest defines location and hash for a specific manifest
type InstanceSpecManifest struct {
type MachineSpecManifest struct {
Path string
Hash string
RequestTimestamp metav1.Time
}

// InstanceStatus defines the observed state of Instance
type InstanceStatus struct {
Converge *InstanceStatusManifest
DryRun *InstanceStatusManifest
// MachineStatus defines the observed state of Machine
type MachineStatus struct {
Converge *MachineStatusManifest
DryRun *MachineStatusManifest
}

// InstaceSpecManifest defines the state and hash of a run manifest
type InstanceManifestState string
type InstanceStatusManifest struct {
State InstanceManifestState
type MachineStatusManifest struct {
State common.MachineManifestState
Hash string
LastUpdateTimestamp metav1.Time
Messages []string
Expand All @@ -50,10 +48,10 @@ type InstanceStatusManifest struct {

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type InstanceList struct {
type MachineList struct {
metav1.TypeMeta
// +optional
metav1.ListMeta

Items []Instance
Items []Machine
}
Loading