github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/services/cd-service/pkg/config/config.go (about)

     1  /*This file is part of kuberpult.
     2  
     3  Kuberpult is free software: you can redistribute it and/or modify
     4  it under the terms of the Expat(MIT) License as published by
     5  the Free Software Foundation.
     6  
     7  Kuberpult is distributed in the hope that it will be useful,
     8  but WITHOUT ANY WARRANTY; without even the implied warranty of
     9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    10  MIT License for more details.
    11  
    12  You should have received a copy of the MIT License
    13  along with kuberpult. If not, see <https://directory.fsf.org/wiki/License:Expat>.
    14  
    15  Copyright 2023 freiheit.com*/
    16  
    17  package config
    18  
    19  type EnvironmentConfig struct {
    20  	Upstream         *EnvironmentConfigUpstream `json:"upstream,omitempty"`
    21  	ArgoCd           *EnvironmentConfigArgoCd   `json:"argocd,omitempty"`
    22  	EnvironmentGroup *string                    `json:"environmentGroup,omitempty"`
    23  }
    24  
    25  type EnvironmentConfigUpstream struct {
    26  	Environment string `json:"environment,omitempty"`
    27  	Latest      bool   `json:"latest,omitempty"`
    28  }
    29  
    30  type AccessEntry struct {
    31  	Group string `json:"group,omitempty"`
    32  	Kind  string `json:"kind,omitempty"`
    33  }
    34  
    35  type EnvironmentConfigArgoCd struct {
    36  	Destination              ArgoCdDestination        `json:"destination"`
    37  	SyncWindows              []ArgoCdSyncWindow       `json:"syncWindows,omitempty"`
    38  	ClusterResourceWhitelist []AccessEntry            `json:"accessList,omitempty"`
    39  	ApplicationAnnotations   map[string]string        `json:"applicationAnnotations,omitempty"`
    40  	IgnoreDifferences        []ArgoCdIgnoreDifference `json:"ignoreDifferences,omitempty"`
    41  	SyncOptions              []string                 `json:"syncOptions,omitempty"`
    42  }
    43  
    44  // ArgoCdDestination
    45  // Namespace takes precedence over AppProjectNamespace and ApplicationNamespace. To use the latter attributes, omit the
    46  // Namespace attribute.
    47  type ArgoCdDestination struct {
    48  	Name                 string  `json:"name"`
    49  	Server               string  `json:"server"`
    50  	Namespace            *string `json:"namespace,omitempty"`
    51  	AppProjectNamespace  *string `json:"appProjectNamespace,omitempty"`
    52  	ApplicationNamespace *string `json:"applicationNamespace,omitempty"`
    53  }
    54  
    55  type ArgoCdSyncWindow struct {
    56  	Schedule string   `json:"schedule,omitempty"`
    57  	Duration string   `json:"duration,omitempty"`
    58  	Kind     string   `json:"kind,omitempty"`
    59  	Apps     []string `json:"applications,omitempty"`
    60  }
    61  
    62  type ArgoCdIgnoreDifference struct {
    63  	Group                 string   `json:"group,omitempty"`
    64  	Kind                  string   `json:"kind"`
    65  	Name                  string   `json:"name,omitempty"`
    66  	Namespace             string   `json:"namespace,omitempty"`
    67  	JSONPointers          []string `json:"jsonPointers,omitempty"`
    68  	JqPathExpressions     []string `json:"jqPathExpressions,omitempty"`
    69  	ManagedFieldsManagers []string `json:"managedFieldsManagers,omitempty"`
    70  }